Package com.iizix.server
Class PrintStream2
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.PrintStream
com.iizix.server.PrintStream2
- All Implemented Interfaces:
- Closeable,- Flushable,- Appendable,- AutoCloseable
A 
PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method. Optionally, a PrintStream can be created so as to flush automatically; this means that the flush method is automatically invoked after a byte array is written, one of the println methods is invoked, or a newline character or byte ('\n') is written.All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes.
- Field Summary- Fields inherited from class java.io.FilterOutputStream- out
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- void- close()Close the stream.- protected voidCheck to make sure that the stream has not been closed- void- flush()Flush the stream.- void- print- (boolean b) Print a boolean value.- void- print- (char c) Print a character.- void- print- (char[] s) Print an array of characters.- void- print- (double d) Print a double-precision floating-point number.- void- print- (float f) Print a floating-point number.- void- print- (int i) Print an integer.- void- print- (long l) Print a long integer.- voidPrint an object.- voidPrint a string.- void- println()Terminate the current line by writing the line separator string.- void- println- (boolean x) Print a boolean and then terminate the line.- void- println- (char x) Print a character and then terminate the line.- void- println- (char[] x) Print an array of characters and then terminate the line.- void- println- (double x) Print a double and then terminate the line.- void- println- (float x) Print a float and then terminate the line.- void- println- (int x) Print an integer and then terminate the line.- void- println- (long x) Print a long and then terminate the line.- voidPrint an Object and then terminate the line.- voidPrint a String and then terminate the line.- void- setNewOutput- (OutputStream out) Sets a new output stream for the output.- void- write- (byte[] buf, int off, int len) Write- lenbytes from the specified byte array starting at offset- offto this stream.- void- write- (int b) Write the specified byte to this stream.- Methods inherited from class java.io.PrintStream- append, append, append, charset, checkError, clearError, format, format, printf, printf, setError, write, writeBytes- Methods inherited from class java.io.OutputStream- nullOutputStream
- Constructor Details- PrintStream2Create a new print stream.- Parameters:
- out- The output stream to which values and objects will be printed
- See Also:
 
 
- Method Details- setNewOutputSets a new output stream for the output. This is used by the rotate trace files.
- ensureOpenCheck to make sure that the stream has not been closed- Throws:
- IOException
 
- flushpublic void flush()Flush the stream. This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.- Specified by:
- flushin interface- Flushable
- Overrides:
- flushin class- PrintStream
- See Also:
 
- closepublic void close()Close the stream. This is done by flushing the stream and then closing the underlying output stream.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- PrintStream
- See Also:
 
- writepublic void write- (int b) Write the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then the- flushmethod will be invoked.- Note that the byte is written as given; to write a character that will be translated according to the platform's default character encoding, use the - print(char)or- println(char)methods.- Overrides:
- writein class- PrintStream
- Parameters:
- b- The byte to be written
- See Also:
 
- writepublic void write- (byte[] buf, int off, int len) Write- lenbytes from the specified byte array starting at offset- offto this stream. If automatic flushing is enabled then the- flushmethod will be invoked.- Note that the bytes will be written as given; to write characters that will be translated according to the platform's default character encoding, use the - print(char)or- println(char)methods.- Overrides:
- writein class- PrintStream
- Parameters:
- buf- A byte array
- off- Offset from which to start taking bytes
- len- Number of bytes to write
 
- printpublic void print- (boolean b) Print a boolean value. The string produced by- String.valueOf(boolean)- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- b- The- booleanto be printed
 
- printpublic void print- (char c) Print a character. The character is translated into one or more bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- c- The- charto be printed
 
- printpublic void print- (int i) Print an integer. The string produced by- String.valueOf(int)- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- i- The- intto be printed
- See Also:
 
- printpublic void print- (long l) Print a long integer. The string produced by- String.valueOf(long)- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- l- The- longto be printed
- See Also:
 
- printpublic void print- (float f) Print a floating-point number. The string produced by- String.valueOf(float)- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- f- The- floatto be printed
- See Also:
 
- printpublic void print- (double d) Print a double-precision floating-point number. The string produced by- String.valueOf(double)- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- d- The- doubleto be printed
- See Also:
 
- printpublic void print- (char[] s) Print an array of characters. The characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- s- The array of chars to be printed
- Throws:
- NullPointerException- If- sis- null
 
- printPrint a string. If the argument is- nullthen the string- "null"is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- s- The- Stringto be printed
 
- printPrint an object. The string produced by the- String.valueOf(Object)- write(int)- Overrides:
- printin class- PrintStream
- Parameters:
- obj- The- Objectto be printed
- See Also:
 
- printlnpublic void println()Terminate the current line by writing the line separator string. The line separator string is defined by the system property- line.separator, and is not necessarily a single newline character (- '\n').- Overrides:
- printlnin class- PrintStream
 
- printlnpublic void println- (boolean x) Print a boolean and then terminate the line. This method behaves as though it invokes- print(boolean)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- booleanto be printed
 
- printlnpublic void println- (char x) Print a character and then terminate the line. This method behaves as though it invokes- print(char)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- charto be printed.
 
- printlnpublic void println- (int x) Print an integer and then terminate the line. This method behaves as though it invokes- print(int)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- intto be printed.
 
- printlnpublic void println- (long x) Print a long and then terminate the line. This method behaves as though it invokes- print(long)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- a The- longto be printed.
 
- printlnpublic void println- (float x) Print a float and then terminate the line. This method behaves as though it invokes- print(float)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- floatto be printed.
 
- printlnpublic void println- (double x) Print a double and then terminate the line. This method behaves as though it invokes- print(double)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- doubleto be printed.
 
- printlnpublic void println- (char[] x) Print an array of characters and then terminate the line. This method behaves as though it invokes- print(char[])- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- an array of chars to print.
 
- printlnPrint a String and then terminate the line. This method behaves as though it invokes- print(String)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- Stringto be printed.
 
- printlnPrint an Object and then terminate the line. This method behaves as though it invokes- print(Object)- println()- Overrides:
- printlnin class- PrintStream
- Parameters:
- x- The- Objectto be printed.