Class ServerWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable
    Direct Known Subclasses:
    ProcessAwareServerWriter

    public abstract class ServerWriter
    extends java.io.Writer
    Server Writer.
    Author:
    Daniel Sagenschneider
    • Field Summary

      • Fields inherited from class java.io.Writer

        lock
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerWriter()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract void write​(byte[] encodedBytes)
      Enables writing encoded bytes.
      abstract void write​(java.nio.ByteBuffer encodedBytes)
      Enables writing encoded bytes.
      abstract void write​(java.nio.channels.FileChannel file, long position, long count, FileCompleteCallback callback)
      Writes part of the FileChannel contents.
      abstract void write​(java.nio.channels.FileChannel file, FileCompleteCallback callback)
      Writes the entire FileChannel contents.
      • Methods inherited from class java.io.Writer

        append, append, append, close, flush, nullWriter, write, write, write, write, write
      • Methods inherited from class java.lang.Object

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

      • ServerWriter

        public ServerWriter()
    • Method Detail

      • write

        public abstract void write​(byte[] encodedBytes)
                            throws java.io.IOException

        Enables writing encoded bytes.

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

        Parameters:
        encodedBytes - Encoded bytes.
        Throws:
        java.io.IOException - If fails to write the bytes.
      • write

        public abstract void write​(java.nio.ByteBuffer encodedBytes)
                            throws java.io.IOException

        Enables writing encoded bytes.

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

        Parameters:
        encodedBytes - ByteBuffer containing the encoded bytes.
        Throws:
        java.io.IOException - If fails to write the bytes.
      • write

        public abstract void write​(java.nio.channels.FileChannel file,
                                   long position,
                                   long count,
                                   FileCompleteCallback callback)
                            throws java.io.IOException

        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.

        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 abstract void write​(java.nio.channels.FileChannel file,
                                   FileCompleteCallback callback)
                            throws java.io.IOException

        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.

        Parameters:
        file - FileChannel.
        callback - Optional FileCompleteCallback. May be null.
        Throws:
        java.io.IOException - If fails to write the FileChannel content.