Class ServerWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
ProcessAwareServerWriter
Writer.- Author:
- Daniel Sagenschneider
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidwrite(byte[] encodedBytes) Enables writing encoded bytes.abstract voidwrite(ByteBuffer encodedBytes) Enables writing encoded bytes.abstract voidwrite(FileChannel file, long position, long count, FileCompleteCallback callback) Writes part of theFileChannelcontents.abstract voidwrite(FileChannel file, FileCompleteCallback callback) Writes the entireFileChannelcontents.
-
Constructor Details
-
ServerWriter
public ServerWriter()
-
-
Method Details
-
write
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
Enables writing encoded bytes.
Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.
- Parameters:
encodedBytes-ByteBuffercontaining 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
FileChannelcontents.This is to enable efficient I/O (ie DMA) of writing
FileChannelcontent.To write the entire
FileChannelcontents, invokewrite(file, 0, -1).Note that the underlying implementation will need to support
FileChannelefficiencies.Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.
- Parameters:
file-FileChannel.position- Position within theFileChannelto start writing content. Must be non-negative number.count- Count of bytes to write from theFileChannel. A negative value (typically-1) indicates to write the remainingFileChannelcontent from position.callback- OptionalFileCompleteCallback. May benull.- Throws:
IOException- If fails to write theFileChannelcontent.
-
write
Writes the entire
FileChannelcontents.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- OptionalFileCompleteCallback. May benull.- Throws:
IOException- If fails to write theFileChannelcontent.
-