|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.io.MySystem
public class MySystem
The MySystem class mimics the features of stdin, stdout, and stderr, enabling these IO streams to be redirected to files.
Field Summary | |
---|---|
static java.io.PrintWriter |
defaultErr
The defaul Error stream corresponds to the Unix stderr. |
static java.io.InputStreamReader |
defaultIn
The default Input stream corresponding to the Unix stdin. |
static java.io.PrintWriter |
defaultOut
The default Output stream corresponding to the Unix stdout. |
Constructor Summary | |
---|---|
MySystem()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
|
static java.lang.String |
paddedFormat(long k,
int space)
Converts an integer to a string with enough leading blanks to fill a space of the specified size. |
static void |
setDefaultErr()
Redirect the default Error stream to System.err. |
static void |
setDefaultErr(java.lang.String fileName)
Redirect the default Error stream to the specified file. |
static void |
setDefaultIn()
Redirect the default Input stream to System.in. |
static void |
setDefaultIn(java.lang.String fileName)
Redirects the default Input stream to the specified file. |
static void |
setDefaultOut()
Redirect the default Output stream to System.out. |
static void |
setDefaultOut(java.lang.String fileName)
Redirect the default Output stream to the specified file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.io.InputStreamReader defaultIn
public static java.io.PrintWriter defaultOut
public static java.io.PrintWriter defaultErr
Constructor Detail |
---|
public MySystem()
Method Detail |
---|
public static void setDefaultIn(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the input file.
java.io.IOException
- in case of a file handling error.public static void setDefaultIn()
public static void setDefaultOut(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the output file.
java.io.IOException
- in case of a file handling error.public static void setDefaultOut()
public static void setDefaultErr(java.lang.String fileName) throws java.io.IOException
fileName
- the name of the error file.
java.io.IOException
- in case of a file handling error.public static void setDefaultErr()
public static java.lang.String paddedFormat(long k, int space)
k
- the long integer to be formattedspace
- the size of the space to be filled
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |