Class ProcessAwareServerWriter
- java.lang.Object
-
- java.io.Writer
-
- net.officefloor.server.stream.ServerWriter
-
- net.officefloor.server.stream.impl.ProcessAwareServerWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class ProcessAwareServerWriter extends ServerWriter
ProcessStateaware writingServerWriter.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ProcessAwareServerWriter(ServerWriter unsafeServerWriter, ManagedObjectContext context)Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.Writerappend(char c)java.io.Writerappend(java.lang.CharSequence csq)java.io.Writerappend(java.lang.CharSequence csq, int start, int end)voidclose()voidflush()voidwrite(byte[] encodedBytes)Enables writing encoded bytes.voidwrite(char[] cbuf)voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(java.lang.String str)voidwrite(java.lang.String str, int off, int len)voidwrite(java.nio.ByteBuffer encodedBytes)Enables writing encoded bytes.voidwrite(java.nio.channels.FileChannel file, long position, long count, FileCompleteCallback callback)Writes part of theFileChannelcontents.voidwrite(java.nio.channels.FileChannel file, FileCompleteCallback callback)Writes the entireFileChannelcontents.
-
-
-
Constructor Detail
-
ProcessAwareServerWriter
public ProcessAwareServerWriter(ServerWriter unsafeServerWriter, ManagedObjectContext context)
Instantiate.- Parameters:
unsafeServerWriter- UnsafeServerWriter.context-ManagedObjectContext.
-
-
Method Detail
-
write
public void write(byte[] encodedBytes) throws java.io.IOExceptionDescription copied from class:ServerWriterEnables writing encoded bytes.
Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.
- Specified by:
writein classServerWriter- Parameters:
encodedBytes- Encoded bytes.- Throws:
java.io.IOException- If fails to write the bytes.
-
write
public void write(java.nio.channels.FileChannel file, long position, long count, FileCompleteCallback callback) throws java.io.IOExceptionDescription copied from class:ServerWriterWrites 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.
- Specified by:
writein classServerWriter- 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:
java.io.IOException- If fails to write theFileChannelcontent.
-
write
public void write(java.nio.channels.FileChannel file, FileCompleteCallback callback) throws java.io.IOExceptionDescription copied from class:ServerWriterWrites 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.
- Specified by:
writein classServerWriter- Parameters:
file-FileChannel.callback- OptionalFileCompleteCallback. May benull.- Throws:
java.io.IOException- If fails to write theFileChannelcontent.
-
write
public void write(java.nio.ByteBuffer encodedBytes) throws java.io.IOExceptionDescription copied from class:ServerWriterEnables writing encoded bytes.
Caution should also be taken to ensure that previous written content is not waiting for further surrogate characters.
- Specified by:
writein classServerWriter- Parameters:
encodedBytes-ByteBuffercontaining the encoded bytes.- Throws:
java.io.IOException- If fails to write the bytes.
-
write
public void write(int c) throws java.io.IOException- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(char[] cbuf) throws java.io.IOException- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(java.lang.String str) throws java.io.IOException- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(java.lang.String str, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
append
public java.io.Writer append(java.lang.CharSequence csq) throws java.io.IOException- Specified by:
appendin interfacejava.lang.Appendable- Overrides:
appendin classjava.io.Writer- Throws:
java.io.IOException
-
append
public java.io.Writer append(java.lang.CharSequence csq, int start, int end) throws java.io.IOException- Specified by:
appendin interfacejava.lang.Appendable- Overrides:
appendin classjava.io.Writer- Throws:
java.io.IOException
-
append
public java.io.Writer append(char c) throws java.io.IOException- Specified by:
appendin interfacejava.lang.Appendable- Overrides:
appendin classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
-