Class WriterPrintStream

All Implemented Interfaces:
com.oracle.coherence.common.io.OutputStreaming, OutputStreaming, Closeable, Flushable, Appendable, AutoCloseable

public class WriterPrintStream extends PrintStream implements OutputStreaming
Overrides PrintStream to delegate to a PrintWriter.
Author:
cp 2000.11.01
  • Field Summary

    Fields inherited from class java.io.FilterOutputStream

    out
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Flush the stream and check its error state.
    void
    Close the stream.
    void
    Flush the stream.
    void
    print(boolean f)
    Print a boolean value.
    void
    print(char ch)
    Print a character.
    void
    print(char[] ach)
    Print an array of characters.
    void
    print(double dfl)
    Print a double-precision floating-point number.
    void
    print(float fl)
    Print a floating-point number.
    void
    print(int i)
    Print an integer.
    void
    print(long l)
    Print a long integer.
    void
    Print an object.
    void
    Print a string.
    void
    Terminate the current line by writing the line separator string.
    void
    println(boolean f)
    Print a boolean and then terminate the line.
    void
    println(char ch)
    Print a character and then terminate the line.
    void
    println(char[] ach)
    Print an array of characters and then terminate the line.
    void
    println(double dfl)
    Print a double and then terminate the line.
    void
    println(float fl)
    Print a float and then terminate the line.
    void
    println(int i)
    Print an integer and then terminate the line.
    void
    println(long l)
    Print a long and then terminate the line.
    void
    Print an Object and then terminate the line.
    void
    Print a String and then terminate the line.
    protected void
    Set the error state of the stream to true.
    void
    write(byte[] ab, int of, int cb)
    Write len bytes from the specified byte array starting at offset off to this stream.
    void
    write(int b)
    Write the specified byte to this stream.

    Methods inherited from class java.io.PrintStream

    append, append, append, charset, clearError, format, format, printf, printf, write, writeBytes

    Methods inherited from class java.io.OutputStream

    nullOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.oracle.coherence.common.io.OutputStreaming

    write
  • Constructor Details

    • WriterPrintStream

      public WriterPrintStream(PrintWriter out)
  • Method Details

    • flush

      public 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:
      flush in interface Flushable
      Specified by:
      flush in interface com.oracle.coherence.common.io.OutputStreaming
      Overrides:
      flush in class PrintStream
      See Also:
    • close

      public void close()
      Close the stream. This is done by flushing the stream and then closing the underlying output stream.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface com.oracle.coherence.common.io.OutputStreaming
      Overrides:
      close in class PrintStream
      See Also:
    • checkError

      public boolean checkError()
      Flush the stream and check its error state. The internal error state is set to true when the underlying output stream throws an IOException other than InterruptedIOException, and when the setError method is invoked. If an operation on the underlying output stream throws an InterruptedIOException, then the PrintStream converts the exception back into an interrupt by doing:
           Thread.currentThread().interrupt();
       
      or the equivalent.
      Overrides:
      checkError in class PrintStream
      Returns:
      True if and only if this stream has encountered an IOException other than InterruptedIOException, or the setError method has been invoked
    • setError

      protected void setError()
      Set the error state of the stream to true.
      Overrides:
      setError in class PrintStream
      Since:
      JDK1.1
    • write

      public void write(int b)
      Write the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then the flush method 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.

      Specified by:
      write in interface com.oracle.coherence.common.io.OutputStreaming
      Overrides:
      write in class PrintStream
      Parameters:
      b - The byte to be written
      See Also:
    • write

      public void write(byte[] ab, int of, int cb)
      Write len bytes from the specified byte array starting at offset off to this stream. If automatic flushing is enabled then the flush method 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.

      Specified by:
      write in interface com.oracle.coherence.common.io.OutputStreaming
      Overrides:
      write in class PrintStream
      Parameters:
      ab - A byte array
      of - Offset from which to start taking bytes
      cb - Number of bytes to write
    • print

      public void print(boolean f)
      Print a boolean value. The string produced by String.valueOf(boolean) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
      Overrides:
      print in class PrintStream
      Parameters:
      f - The boolean to be printed
    • print

      public void print(char ch)
      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) method.
      Overrides:
      print in class PrintStream
      Parameters:
      ch - The char to be printed
    • print

      public void print(int i)
      Print an integer. The string produced by String.valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
      Overrides:
      print in class PrintStream
      Parameters:
      i - The int to be printed
      See Also:
    • print

      public void print(long l)
      Print a long integer. The string produced by String.valueOf(long) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
      Overrides:
      print in class PrintStream
      Parameters:
      l - The long to be printed
      See Also:
    • print

      public void print(float fl)
      Print a floating-point number. The string produced by String.valueOf(float) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
      Overrides:
      print in class PrintStream
      Parameters:
      fl - The float to be printed
      See Also:
    • print

      public void print(double dfl)
      Print a double-precision floating-point number. The string produced by String.valueOf(double) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
      Overrides:
      print in class PrintStream
      Parameters:
      dfl - The double to be printed
      See Also:
    • print

      public void print(char[] ach)
      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) method.
      Overrides:
      print in class PrintStream
      Parameters:
      ach - The array of chars to be printed
      Throws:
      NullPointerException - If s is null
    • print

      public void print(String s)
      Print a string. If the argument is null then 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) method.
      Overrides:
      print in class PrintStream
      Parameters:
      s - The String to be printed
    • print

      public void print(Object o)
      Print an object. The string produced by the String.valueOf(Object) method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method.
      Overrides:
      print in class PrintStream
      Parameters:
      o - The Object to be printed
      See Also:
    • println

      public 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:
      println in class PrintStream
    • println

      public void println(boolean f)
      Print a boolean and then terminate the line. This method behaves as though it invokes print(boolean) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      f - The boolean to be printed
    • println

      public void println(char ch)
      Print a character and then terminate the line. This method behaves as though it invokes print(char) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      ch - The char to be printed.
    • println

      public void println(int i)
      Print an integer and then terminate the line. This method behaves as though it invokes print(int) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      i - The int to be printed.
    • println

      public void println(long l)
      Print a long and then terminate the line. This method behaves as though it invokes print(long) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      l - a The long to be printed.
    • println

      public void println(float fl)
      Print a float and then terminate the line. This method behaves as though it invokes print(float) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      fl - The float to be printed.
    • println

      public void println(double dfl)
      Print a double and then terminate the line. This method behaves as though it invokes print(double) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      dfl - The double to be printed.
    • println

      public void println(char[] ach)
      Print an array of characters and then terminate the line. This method behaves as though it invokes print(char[]) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      ach - an array of chars to print.
    • println

      public void println(String s)
      Print a String and then terminate the line. This method behaves as though it invokes print(String) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      s - The String to be printed.
    • println

      public void println(Object o)
      Print an Object and then terminate the line. This method behaves as though it invokes print(Object) and then println().
      Overrides:
      println in class PrintStream
      Parameters:
      o - The Object to be printed.