|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.streams.AbstractStreamWriter
public abstract class AbstractStreamWriter
Write the primitive Java type to the current ByteBuffer. If it doesn't fit, call the BufferHandler, and write to the result, which becomes the new current ByteBuffer. Arrays will be written across multiple ByteBuffers if necessary, but all primitives will be written to a single ByteBuffer.
| Nested Class Summary | |
|---|---|
static class |
AbstractStreamWriter.DisposeBufferCompletionHandler
|
| Field Summary | |
|---|---|
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
|
| Constructor Summary | |
|---|---|
protected |
AbstractStreamWriter(Connection connection,
Output streamOutput)
Create a new ByteBufferWriter. |
| Method Summary | ||
|---|---|---|
void |
close()
|
|
GrizzlyFuture<java.lang.Integer> |
close(CompletionHandler<java.lang.Integer> completionHandler)
Close the StreamWriter and make sure all data was flushed. |
|
|
encode(Transformer<E,Buffer> encoder,
E object)
|
|
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
protected AbstractStreamWriter(Connection connection,
Output streamOutput)
| Method Detail |
|---|
public GrizzlyFuture<java.lang.Integer> flush()
throws java.io.IOException
flush in interface StreamWriterjava.io.IOException
public 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 StreamWriter
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
public 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.IOException
public void writeBuffer(Buffer b)
throws java.io.IOException
Buffer to the StreamWriter.
writeBuffer in interface StreamWriterb - Buffer.
java.io.IOException
public void writeBoolean(boolean data)
throws java.io.IOException
writeBoolean in interface StreamWriterdata - boolean value.
java.io.IOException
public void writeByte(byte data)
throws java.io.IOException
writeByte in interface StreamWriterdata - byte value.
java.io.IOException
public void writeChar(char data)
throws java.io.IOException
writeChar in interface StreamWriterdata - char value.
java.io.IOException
public void writeShort(short data)
throws java.io.IOException
writeShort in interface StreamWriterdata - short value.
java.io.IOException
public void writeInt(int data)
throws java.io.IOException
StreamWriter
writeInt in interface StreamWriterdata - int value.
java.io.IOException
public void writeLong(long data)
throws java.io.IOException
writeLong in interface StreamWriterdata - long value.
java.io.IOException
public void writeFloat(float data)
throws java.io.IOException
writeFloat in interface StreamWriterdata - float value.
java.io.IOException
public void writeDouble(double data)
throws java.io.IOException
writeDouble in interface StreamWriterdata - double value.
java.io.IOException
public void writeBooleanArray(boolean[] data)
throws java.io.IOException
writeBooleanArray in interface StreamWriterdata - array of boolean values.
java.io.IOException
public void writeByteArray(byte[] data)
throws java.io.IOException
writeByteArray in interface StreamWriterdata - array of byte values.
java.io.IOException
public 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.IOException
public void writeCharArray(char[] data)
throws java.io.IOException
writeCharArray in interface StreamWriterdata - array of char values.
java.io.IOException
public void writeShortArray(short[] data)
throws java.io.IOException
writeShortArray in interface StreamWriterdata - array of short values.
java.io.IOException
public void writeIntArray(int[] data)
throws java.io.IOException
writeIntArray in interface StreamWriterdata - array of int values.
java.io.IOException
public void writeLongArray(long[] data)
throws java.io.IOException
writeLongArray in interface StreamWriterdata - array of long values.
java.io.IOException
public void writeFloatArray(float[] data)
throws java.io.IOException
writeFloatArray in interface StreamWriterdata - array of float values.
java.io.IOException
public void writeDoubleArray(double[] data)
throws java.io.IOException
writeDoubleArray in interface StreamWriterdata - array of double values.
java.io.IOException
public <E> GrizzlyFuture<Stream> encode(Transformer<E,Buffer> encoder,
E object)
throws java.io.IOException
encode in interface StreamWriterjava.io.IOException
public <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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||