Package net.officefloor.server.stream
Class ServerOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- net.officefloor.server.stream.ServerOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
- Direct Known Subclasses:
BufferPoolServerOutputStream
,ProcessAwareServerOutputStream
public abstract class ServerOutputStream extends java.io.OutputStream
OutputStream
with additional methods to write cachedByteBuffer
instances.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ServerOutputStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
write(java.nio.ByteBuffer buffer)
Writes aByteBuffer
.abstract void
write(java.nio.channels.FileChannel file, long position, long count, FileCompleteCallback callback)
Writes part of theFileChannel
contents.abstract void
write(java.nio.channels.FileChannel file, FileCompleteCallback callback)
Writes the entireFileChannel
contents.
-
-
-
Method Detail
-
write
public abstract void write(java.nio.ByteBuffer buffer) throws java.io.IOException
Writes a
ByteBuffer
.This is to enable efficient I/O of writing content (typically cached).
- Parameters:
buffer
-ByteBuffer
that should never change its content.- Throws:
java.io.IOException
- If fails to write theByteBuffer
.
-
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, invokewrite(file, 0, -1)
.Note that the underlying implementation will need to support
FileChannel
efficiencies.- Parameters:
file
-FileChannel
.position
- Position within theFileChannel
to 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 remainingFileChannel
content from position.callback
- OptionalFileCompleteCallback
. May benull
.- Throws:
java.io.IOException
- If fails to write theFileChannel
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)
.- Parameters:
file
-FileChannel
.callback
- OptionalFileCompleteCallback
. May benull
.- Throws:
java.io.IOException
- If fails to write theFileChannel
content.
-
-