Class ProcessAwareServerWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
ProcessState aware writing ServerWriter.- Author:
- Daniel Sagenschneider
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionProcessAwareServerWriter(ServerWriter unsafeServerWriter, ManagedObjectContext context) Instantiate. -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(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) voidvoidvoidwrite(ByteBuffer encodedBytes) Enables writing encoded bytes.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.Writer
nullWriter
-
Constructor Details
-
ProcessAwareServerWriter
Instantiate.- Parameters:
unsafeServerWriter- UnsafeServerWriter.context-ManagedObjectContext.
-
-
Method Details
-
write
Description 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:
IOException- If fails to write the bytes.
-
write
public void write(FileChannel file, long position, long count, FileCompleteCallback callback) throws IOException Description 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:
IOException- If fails to write theFileChannelcontent.
-
write
Description 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:
IOException- If fails to write theFileChannelcontent.
-
write
Description 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:
IOException- If fails to write the bytes.
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Specified by:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
write
- Overrides:
writein classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-