Class ProcessAwareServerWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

    public class ProcessAwareServerWriter
    extends ServerWriter
    ProcessState aware writing ServerWriter.
    Author:
    Daniel Sagenschneider
    • Field Summary

      • Fields inherited from class java.io.Writer

        lock
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.Writer append​(char c)  
      java.io.Writer append​(java.lang.CharSequence csq)  
      java.io.Writer append​(java.lang.CharSequence csq, int start, int end)  
      void close()  
      void flush()  
      void write​(byte[] encodedBytes)
      Enables writing encoded bytes.
      void write​(char[] cbuf)  
      void write​(char[] cbuf, int off, int len)  
      void write​(int c)  
      void write​(java.lang.String str)  
      void write​(java.lang.String str, int off, int len)  
      void write​(java.nio.ByteBuffer encodedBytes)
      Enables writing encoded bytes.
      void write​(java.nio.channels.FileChannel file, long position, long count, FileCompleteCallback callback)
      Writes part of the FileChannel contents.
      void write​(java.nio.channels.FileChannel file, FileCompleteCallback callback)
      Writes the entire FileChannel contents.
      • Methods inherited from class java.io.Writer

        nullWriter
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • write

        public void write​(byte[] encodedBytes)
                   throws java.io.IOException
        Description copied from class: ServerWriter

        Enables writing encoded bytes.

        Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.

        Specified by:
        write in class ServerWriter
        Parameters:
        encodedBytes - Encoded bytes.
        Throws:
        java.io.IOException - If fails to write the bytes.
      • write

        public void write​(java.nio.channels.FileChannel file,
                          long position,
                          long count,
                          FileCompleteCallback callback)
                   throws java.io.IOException
        Description copied from class: ServerWriter

        Writes part of the FileChannel contents.

        This is to enable efficient I/O (ie DMA) of writing FileChannel content.

        To write the entire FileChannel contents, invoke write(file, 0, -1).

        Note that the underlying implementation will need to support FileChannel efficiencies.

        Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.

        Specified by:
        write in class ServerWriter
        Parameters:
        file - FileChannel.
        position - Position within the FileChannel to start writing content. Must be non-negative number.
        count - Count of bytes to write from the FileChannel. A negative value (typically -1) indicates to write the remaining FileChannel content from position.
        callback - Optional FileCompleteCallback. May be null.
        Throws:
        java.io.IOException - If fails to write the FileChannel content.
      • write

        public void write​(java.nio.channels.FileChannel file,
                          FileCompleteCallback callback)
                   throws java.io.IOException
        Description copied from class: ServerWriter

        Writes the entire FileChannel contents.

        This is a convenience method for write(file, 0, -1).

        Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.

        Specified by:
        write in class ServerWriter
        Parameters:
        file - FileChannel.
        callback - Optional FileCompleteCallback. May be null.
        Throws:
        java.io.IOException - If fails to write the FileChannel content.
      • write

        public void write​(java.nio.ByteBuffer encodedBytes)
                   throws java.io.IOException
        Description copied from class: ServerWriter

        Enables writing encoded bytes.

        Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.

        Specified by:
        write in class ServerWriter
        Parameters:
        encodedBytes - ByteBuffer containing the encoded bytes.
        Throws:
        java.io.IOException - If fails to write the bytes.
      • write

        public void write​(int c)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(char[] cbuf)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(char[] cbuf,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(java.lang.String str)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • write

        public void write​(java.lang.String str,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.Writer
        Throws:
        java.io.IOException
      • append

        public java.io.Writer append​(java.lang.CharSequence csq)
                              throws java.io.IOException
        Specified by:
        append in interface java.lang.Appendable
        Overrides:
        append in class java.io.Writer
        Throws:
        java.io.IOException
      • append

        public java.io.Writer append​(java.lang.CharSequence csq,
                                     int start,
                                     int end)
                              throws java.io.IOException
        Specified by:
        append in interface java.lang.Appendable
        Overrides:
        append in class java.io.Writer
        Throws:
        java.io.IOException
      • append

        public java.io.Writer append​(char c)
                              throws java.io.IOException
        Specified by:
        append in interface java.lang.Appendable
        Overrides:
        append in class java.io.Writer
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in class java.io.Writer
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class java.io.Writer
        Throws:
        java.io.IOException