public abstract class AbstractStreamWriter extends Object implements StreamWriter
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractStreamWriter.DisposeBufferCompletionHandler |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isOutputBuffered |
protected static Logger |
logger |
protected Output |
output |
protected static Integer |
ZERO |
protected static GrizzlyFuture<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<Integer> |
close(CompletionHandler<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<Integer> |
flush()
Cause the overflow handler to be called even if buffer is not full.
|
GrizzlyFuture<Integer> |
flush(CompletionHandler<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(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,
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 Logger logger
protected static final Integer ZERO
protected static final GrizzlyFuture<Integer> ZERO_READY_FUTURE
protected final boolean isOutputBuffered
protected final Output output
protected AbstractStreamWriter(Connection connection, Output streamOutput)
public GrizzlyFuture<Integer> flush() throws IOException
flush in interface StreamWriterIOExceptionpublic GrizzlyFuture<Integer> flush(CompletionHandler<Integer> completionHandler) throws IOException
flush in interface StreamWriterIOExceptionpublic boolean isClosed()
isClosed in interface StreamWriterpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic GrizzlyFuture<Integer> close(CompletionHandler<Integer> completionHandler) throws IOException
StreamWriter and make sure all data was flushed.close in interface StreamWriterIOExceptionpublic void writeBuffer(Buffer b) throws IOException
Buffer to the StreamWriter.writeBuffer in interface StreamWriterb - Buffer.IOExceptionpublic void writeBoolean(boolean data)
throws IOException
writeBoolean in interface StreamWriterdata - boolean value.IOExceptionpublic void writeByte(byte data)
throws IOException
writeByte in interface StreamWriterdata - byte value.IOExceptionpublic void writeChar(char data)
throws IOException
writeChar in interface StreamWriterdata - char value.IOExceptionpublic void writeShort(short data)
throws IOException
writeShort in interface StreamWriterdata - short value.IOExceptionpublic void writeInt(int data)
throws IOException
StreamWriterwriteInt in interface StreamWriterdata - int value.IOExceptionpublic void writeLong(long data)
throws IOException
writeLong in interface StreamWriterdata - long value.IOExceptionpublic void writeFloat(float data)
throws IOException
writeFloat in interface StreamWriterdata - float value.IOExceptionpublic void writeDouble(double data)
throws IOException
writeDouble in interface StreamWriterdata - double value.IOExceptionpublic void writeBooleanArray(boolean[] data)
throws IOException
writeBooleanArray in interface StreamWriterdata - array of boolean values.IOExceptionpublic void writeByteArray(byte[] data)
throws IOException
writeByteArray in interface StreamWriterdata - array of byte values.IOExceptionpublic void writeByteArray(byte[] data,
int offset,
int length)
throws IOException
writeByteArray in interface StreamWriterdata - array of byte values.offset - array offset to start from.length - number of bytes to write.IOExceptionpublic void writeCharArray(char[] data)
throws IOException
writeCharArray in interface StreamWriterdata - array of char values.IOExceptionpublic void writeShortArray(short[] data)
throws IOException
writeShortArray in interface StreamWriterdata - array of short values.IOExceptionpublic void writeIntArray(int[] data)
throws IOException
writeIntArray in interface StreamWriterdata - array of int values.IOExceptionpublic void writeLongArray(long[] data)
throws IOException
writeLongArray in interface StreamWriterdata - array of long values.IOExceptionpublic void writeFloatArray(float[] data)
throws IOException
writeFloatArray in interface StreamWriterdata - array of float values.IOExceptionpublic void writeDoubleArray(double[] data)
throws IOException
writeDoubleArray in interface StreamWriterdata - array of double values.IOExceptionpublic <E> GrizzlyFuture<Stream> encode(Transformer<E,Buffer> encoder, E object) throws IOException
encode in interface StreamWriterIOExceptionpublic <E> GrizzlyFuture<Stream> encode(Transformer<E,Buffer> encoder, E object, CompletionHandler<Stream> completionHandler) throws IOException
encode in interface StreamWriterIOExceptionpublic Connection getConnection()
Connection this StreamWriter belongs to.getConnection in interface StreamgetConnection in interface StreamWriterConnection this StreamWriter belongs to.public long getTimeout(TimeUnit timeunit)
getTimeout in interface StreamWritertimeunit - timeout unit TimeUnit.public void setTimeout(long timeout,
TimeUnit timeunit)
setTimeout in interface StreamWritertimeout - the timeout for StreamWriter I/O operations.timeunit - timeout unit TimeUnit.Copyright © 2013 Oracle Corporation. All Rights Reserved.