public abstract class AbstractStreamWriter extends java.lang.Object implements StreamWriter
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractStreamWriter.DisposeBufferCompletionHandler |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isOutputBuffered |
protected static java.util.logging.Logger |
logger |
protected Output |
output |
protected static java.lang.Integer |
ZERO |
protected static GrizzlyFuture<java.lang.Integer> |
ZERO_READY_FUTURE |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStreamWriter(Connection connection,
Output streamOutput)
Create a new ByteBufferWriter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
GrizzlyFuture<java.lang.Integer> |
close(CompletionHandler<java.lang.Integer> completionHandler)
Close the
StreamWriter and make sure all data was flushed. |
<E> GrizzlyFuture<Stream> |
encode(Transformer<E,Buffer> encoder,
E object) |
<E> GrizzlyFuture<Stream> |
encode(Transformer<E,Buffer> encoder,
E object,
CompletionHandler<Stream> completionHandler) |
GrizzlyFuture<java.lang.Integer> |
flush()
Cause the overflow handler to be called even if buffer is not full.
|
GrizzlyFuture<java.lang.Integer> |
flush(CompletionHandler<java.lang.Integer> completionHandler)
Cause the overflow handler to be called even if buffer is not full.
|
Connection |
getConnection()
Get the
Connection this StreamWriter belongs to. |
long |
getTimeout(java.util.concurrent.TimeUnit timeunit)
Get the timeout for StreamWriter I/O operations.
|
boolean |
isClosed()
Returns true, if StreamReader has been closed,
or false otherwise.
|
void |
setTimeout(long timeout,
java.util.concurrent.TimeUnit timeunit)
Set the timeout for StreamWriter I/O operations.
|
void |
writeBoolean(boolean data)
Write the boolean value to the StreamWriter.
|
void |
writeBooleanArray(boolean[] data)
Write the array of boolean values to the StreamWriter.
|
void |
writeBuffer(Buffer b)
Write the
Buffer to the StreamWriter. |
void |
writeByte(byte data)
Write the byte value to the StreamWriter.
|
void |
writeByteArray(byte[] data)
Write the array of byte values to the StreamWriter.
|
void |
writeByteArray(byte[] data,
int offset,
int length)
Write the part of array of byte values to the
StreamWriter, using specific offset and length values.
|
void |
writeChar(char data)
Write the char value to the StreamWriter.
|
void |
writeCharArray(char[] data)
Write the array of char values to the StreamWriter.
|
void |
writeDouble(double data)
Write the double value to the StreamWriter.
|
void |
writeDoubleArray(double[] data)
Write the array of double values to the StreamWriter.
|
void |
writeFloat(float data)
Write the float value to the StreamWriter.
|
void |
writeFloatArray(float[] data)
Write the array of float values to the StreamWriter.
|
void |
writeInt(int data)
Write the int value to the StreamWriter.
|
void |
writeIntArray(int[] data)
Write the array of int values to the StreamWriter.
|
void |
writeLong(long data)
Write the long value to the StreamWriter.
|
void |
writeLongArray(long[] data)
Write the array of long values to the StreamWriter.
|
void |
writeShort(short data)
Write the short value to the StreamWriter.
|
void |
writeShortArray(short[] data)
Write the array of short values to the StreamWriter.
|
protected static final java.util.logging.Logger logger
protected static final java.lang.Integer ZERO
protected static final GrizzlyFuture<java.lang.Integer> ZERO_READY_FUTURE
protected final boolean isOutputBuffered
protected final Output output
protected AbstractStreamWriter(Connection connection, Output streamOutput)
public GrizzlyFuture<java.lang.Integer> flush() throws java.io.IOException
flush in interface StreamWriterjava.io.IOExceptionpublic GrizzlyFuture<java.lang.Integer> flush(CompletionHandler<java.lang.Integer> completionHandler) throws java.io.IOException
flush in interface StreamWriterjava.io.IOExceptionpublic boolean isClosed()
isClosed in interface StreamWriterpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic GrizzlyFuture<java.lang.Integer> close(CompletionHandler<java.lang.Integer> completionHandler) throws java.io.IOException
StreamWriter and make sure all data was flushed.close in interface StreamWriterjava.io.IOExceptionpublic void writeBuffer(Buffer b) throws java.io.IOException
Buffer to the StreamWriter.writeBuffer in interface StreamWriterb - Buffer.java.io.IOExceptionpublic void writeBoolean(boolean data)
throws java.io.IOException
writeBoolean in interface StreamWriterdata - boolean value.java.io.IOExceptionpublic void writeByte(byte data)
throws java.io.IOException
writeByte in interface StreamWriterdata - byte value.java.io.IOExceptionpublic void writeChar(char data)
throws java.io.IOException
writeChar in interface StreamWriterdata - char value.java.io.IOExceptionpublic void writeShort(short data)
throws java.io.IOException
writeShort in interface StreamWriterdata - short value.java.io.IOExceptionpublic void writeInt(int data)
throws java.io.IOException
StreamWriterwriteInt in interface StreamWriterdata - int value.java.io.IOExceptionpublic void writeLong(long data)
throws java.io.IOException
writeLong in interface StreamWriterdata - long value.java.io.IOExceptionpublic void writeFloat(float data)
throws java.io.IOException
writeFloat in interface StreamWriterdata - float value.java.io.IOExceptionpublic void writeDouble(double data)
throws java.io.IOException
writeDouble in interface StreamWriterdata - double value.java.io.IOExceptionpublic void writeBooleanArray(boolean[] data)
throws java.io.IOException
writeBooleanArray in interface StreamWriterdata - array of boolean values.java.io.IOExceptionpublic void writeByteArray(byte[] data)
throws java.io.IOException
writeByteArray in interface StreamWriterdata - array of byte values.java.io.IOExceptionpublic void writeByteArray(byte[] data,
int offset,
int length)
throws java.io.IOException
writeByteArray in interface StreamWriterdata - array of byte values.offset - array offset to start from.length - number of bytes to write.java.io.IOExceptionpublic void writeCharArray(char[] data)
throws java.io.IOException
writeCharArray in interface StreamWriterdata - array of char values.java.io.IOExceptionpublic void writeShortArray(short[] data)
throws java.io.IOException
writeShortArray in interface StreamWriterdata - array of short values.java.io.IOExceptionpublic void writeIntArray(int[] data)
throws java.io.IOException
writeIntArray in interface StreamWriterdata - array of int values.java.io.IOExceptionpublic void writeLongArray(long[] data)
throws java.io.IOException
writeLongArray in interface StreamWriterdata - array of long values.java.io.IOExceptionpublic void writeFloatArray(float[] data)
throws java.io.IOException
writeFloatArray in interface StreamWriterdata - array of float values.java.io.IOExceptionpublic void writeDoubleArray(double[] data)
throws java.io.IOException
writeDoubleArray in interface StreamWriterdata - array of double values.java.io.IOExceptionpublic <E> GrizzlyFuture<Stream> encode(Transformer<E,Buffer> encoder, E object) throws java.io.IOException
encode in interface StreamWriterjava.io.IOExceptionpublic <E> GrizzlyFuture<Stream> encode(Transformer<E,Buffer> encoder, E object, CompletionHandler<Stream> completionHandler) throws java.io.IOException
encode in interface StreamWriterjava.io.IOExceptionpublic Connection getConnection()
Connection this StreamWriter belongs to.getConnection in interface StreamgetConnection in interface StreamWriterConnection this StreamWriter belongs to.public long getTimeout(java.util.concurrent.TimeUnit timeunit)
getTimeout in interface StreamWritertimeunit - timeout unit TimeUnit.public void setTimeout(long timeout,
java.util.concurrent.TimeUnit timeunit)
setTimeout in interface StreamWritertimeout - the timeout for StreamWriter I/O operations.timeunit - timeout unit TimeUnit.Copyright © 2018 Oracle Corporation. All Rights Reserved.