Class ServerWriter

java.lang.Object
java.io.Writer
net.officefloor.server.stream.ServerWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Direct Known Subclasses:
ProcessAwareServerWriter

public abstract class ServerWriter extends Writer
Server Writer.
Author:
Daniel Sagenschneider
  • Constructor Details

    • ServerWriter

      public ServerWriter()
  • Method Details

    • write

      public abstract void write(byte[] encodedBytes) throws 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:
      IOException - If fails to write the bytes.
    • write

      public abstract void write(ByteBuffer encodedBytes) throws 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:
      IOException - If fails to write the bytes.
    • write

      public abstract void write(FileChannel file, long position, long count, FileCompleteCallback callback) throws 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:
      IOException - If fails to write the FileChannel content.
    • write

      public abstract void write(FileChannel file, FileCompleteCallback callback) throws 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:
      IOException - If fails to write the FileChannel content.