Package net.officefloor.server.stream
Class ServerOutputStream
java.lang.Object
java.io.OutputStream
net.officefloor.server.stream.ServerOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
BufferPoolServerOutputStream,ProcessAwareServerOutputStream
OutputStream with additional methods to write cached
ByteBuffer instances.- Author:
- Daniel Sagenschneider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidwrite(ByteBuffer buffer) Writes aByteBuffer.abstract voidwrite(FileChannel file, long position, long count, FileCompleteCallback callback) Writes part of theFileChannelcontents.abstract voidwrite(FileChannel file, FileCompleteCallback callback) Writes the entireFileChannelcontents.Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream, write, write, write
-
Constructor Details
-
ServerOutputStream
public ServerOutputStream()
-
-
Method Details
-
write
Writes a
ByteBuffer.This is to enable efficient I/O of writing content (typically cached).
- Parameters:
buffer-ByteBufferthat should never change its content.- Throws:
IOException- If fails to write theByteBuffer.
-
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.- 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).- Parameters:
file-FileChannel.callback- OptionalFileCompleteCallback. May benull.- Throws:
IOException- If fails to write theFileChannelcontent.
-