Class ProcessAwareServerOutputStream
java.lang.Object
java.io.OutputStream
net.officefloor.server.stream.ServerOutputStream
net.officefloor.server.stream.impl.ProcessAwareServerOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
ProcessState aware wrapping ServerOutputStream.- Author:
- Daniel Sagenschneider
-
Constructor Summary
ConstructorsConstructorDescriptionProcessAwareServerOutputStream(ServerOutputStream unsafeOutputStream, ManagedObjectContext context) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b) voidwrite(ByteBuffer buffer) Writes aByteBuffer.voidwrite(FileChannel file, long position, long count, FileCompleteCallback callback) Writes part of theFileChannelcontents.voidwrite(FileChannel file, FileCompleteCallback callback) Writes the entireFileChannelcontents.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ProcessAwareServerOutputStream
public ProcessAwareServerOutputStream(ServerOutputStream unsafeOutputStream, ManagedObjectContext context) Instantiate.- Parameters:
unsafeOutputStream- UnsafeServerOutputStream.context-ManagedObjectContext.
-
-
Method Details
-
write
Description copied from class:ServerOutputStreamWrites a
ByteBuffer.This is to enable efficient I/O of writing content (typically cached).
- Specified by:
writein classServerOutputStream- Parameters:
buffer-ByteBufferthat should never change its content.- Throws:
IOException- If fails to write theByteBuffer.
-
write
public void write(FileChannel file, long position, long count, FileCompleteCallback callback) throws IOException Description copied from class:ServerOutputStreamWrites 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.- Specified by:
writein classServerOutputStream- 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
Description copied from class:ServerOutputStreamWrites the entire
FileChannelcontents.This is a convenience method for
write(file, 0, -1).- Specified by:
writein classServerOutputStream- Parameters:
file-FileChannel.callback- OptionalFileCompleteCallback. May benull.- Throws:
IOException- If fails to write theFileChannelcontent.
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-