public class SystemIOUtilities extends Object
System
I/O streams with helpful alternative implementations to make some
testing jobs easier. This class is really for use by infrastructure
and support code, and students should never need to use it directly.
Since this class provides only static methods, clients should not create an instance. As a result, it provides no public constructors.
Modifier | Constructor and Description |
---|---|
protected |
SystemIOUtilities()
Since this class provides only static methods, clients should not create
an instance.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertNotOnServer()
Checks to see if the calling program is running under the Apache
Tomcat servlet container.
|
static PrintStreamWithHistory |
err()
Get a "wrapped" version of
System.err that provides
history recording functions. |
static boolean |
isInApplet() |
static boolean |
isOnServer()
Checks to see if the calling program is running under the Apache
Tomcat servlet container.
|
static PrintStreamWithHistory |
out()
Get a "wrapped" version of
System.out that provides
history recording functions. |
static void |
replaceSystemInContents(String contents)
Replace
System.in with the contents of the given string. |
static void |
restoreSystemErr()
"Unwrap"
System.err by removing any history recording
wrapper, and return it to its original state. |
static void |
restoreSystemIn()
Restore
System.in to its original value. |
static void |
restoreSystemOut()
"Unwrap"
System.out by removing any history recording
wrapper, and return it to its original state. |
protected SystemIOUtilities()
UnsupportedOperationException
- Always thrown if this
constructor is invoked.public static PrintStreamWithHistory out()
System.out
that provides
history recording functions.public static void restoreSystemOut()
System.out
by removing any history recording
wrapper, and return it to its original state.public static PrintStreamWithHistory err()
System.err
that provides
history recording functions.public static void restoreSystemErr()
System.err
by removing any history recording
wrapper, and return it to its original state.public static void replaceSystemInContents(String contents)
System.in
with the contents of the given string.contents
- The content to read frompublic static void restoreSystemIn()
System.in
to its original value.public static boolean isOnServer()
public static boolean isInApplet()
public static void assertNotOnServer()