Package org.glassfish.grizzly.streams
Class BufferedOutput
- java.lang.Object
-
- org.glassfish.grizzly.streams.BufferedOutput
-
- All Implemented Interfaces:
Output
- Direct Known Subclasses:
DefaultStreamWriter.Output,TransformerOutput
public abstract class BufferedOutput extends java.lang.Object implements Output
- Author:
- oleksiys
-
-
Field Summary
Fields Modifier and Type Field Description protected intbufferSizeprotected java.util.concurrent.atomic.AtomicBooleanisClosedprotected CompositeBuffermultiBufferWindowprotected static java.lang.IntegerZEROprotected static GrizzlyFuture<java.lang.Integer>ZERO_READY_FUTURE
-
Constructor Summary
Constructors Constructor Description BufferedOutput()BufferedOutput(int bufferSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description GrizzlyFuture<java.lang.Integer>close(CompletionHandler<java.lang.Integer> completionHandler)Close theStreamWriterand make sure all data was flushed.voidensureBufferCapacity(int size)GrizzlyFuture<java.lang.Integer>flush(CompletionHandler<java.lang.Integer> completionHandler)Make sure that all data that has been written is flushed from the stream to its destination.protected abstract GrizzlyFuture<java.lang.Integer>flush0(Buffer buffer, CompletionHandler<java.lang.Integer> completionHandler)BuffergetBuffer()Return the Input'sBuffer.protected intgetBufferedSize()booleanisBuffered()protected abstract BuffernewBuffer(int size)protected abstract voidonClosed()protected abstract BufferreallocateBuffer(Buffer oldBuffer, int size)voidwrite(byte data)voidwrite(Buffer bufferToWrite)
-
-
-
Field Detail
-
ZERO
protected static final java.lang.Integer ZERO
-
ZERO_READY_FUTURE
protected static final GrizzlyFuture<java.lang.Integer> ZERO_READY_FUTURE
-
bufferSize
protected final int bufferSize
-
multiBufferWindow
protected CompositeBuffer multiBufferWindow
-
isClosed
protected final java.util.concurrent.atomic.AtomicBoolean isClosed
-
-
Method Detail
-
onClosed
protected abstract void onClosed() throws java.io.IOException- Throws:
java.io.IOException
-
flush0
protected abstract GrizzlyFuture<java.lang.Integer> flush0(Buffer buffer, CompletionHandler<java.lang.Integer> completionHandler) throws java.io.IOException
- Throws:
java.io.IOException
-
newBuffer
protected abstract Buffer newBuffer(int size)
-
write
public void write(byte data) throws java.io.IOException
-
write
public void write(Buffer bufferToWrite) throws java.io.IOException
-
isBuffered
public boolean isBuffered()
- Specified by:
isBufferedin interfaceOutput
-
getBuffer
public Buffer getBuffer()
Description copied from interface:OutputReturn the Input'sBuffer.
-
ensureBufferCapacity
public void ensureBufferCapacity(int size) throws java.io.IOException- Specified by:
ensureBufferCapacityin interfaceOutput- Throws:
java.io.IOException
-
flush
public GrizzlyFuture<java.lang.Integer> flush(CompletionHandler<java.lang.Integer> completionHandler) throws java.io.IOException
Description copied from interface:OutputMake sure that all data that has been written is flushed from the stream to its destination.
-
close
public GrizzlyFuture<java.lang.Integer> close(CompletionHandler<java.lang.Integer> completionHandler) throws java.io.IOException
Description copied from interface:OutputClose theStreamWriterand make sure all data was flushed.
-
getBufferedSize
protected int getBufferedSize()
-
-