org.glassfish.grizzly.streams
Class BufferedOutput

java.lang.Object
  extended by 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
protected  int bufferSize
           
protected  java.util.concurrent.atomic.AtomicBoolean isClosed
           
protected  CompositeBuffer multiBufferWindow
           
protected static java.lang.Integer ZERO
           
protected static GrizzlyFuture<java.lang.Integer> ZERO_READY_FUTURE
           
 
Constructor Summary
BufferedOutput()
           
BufferedOutput(int bufferSize)
           
 
Method Summary
 GrizzlyFuture<java.lang.Integer> close(CompletionHandler<java.lang.Integer> completionHandler)
          Close the StreamWriter and make sure all data was flushed.
 void ensureBufferCapacity(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)
           
 Buffer getBuffer()
          Return the Input's Buffer.
protected  int getBufferedSize()
           
 boolean isBuffered()
           
protected abstract  Buffer newBuffer(int size)
           
protected abstract  void onClosed()
           
protected abstract  Buffer reallocateBuffer(Buffer oldBuffer, int size)
           
 void write(Buffer bufferToWrite)
           
 void write(byte data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

BufferedOutput

public BufferedOutput()

BufferedOutput

public BufferedOutput(int bufferSize)
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)

reallocateBuffer

protected abstract Buffer reallocateBuffer(Buffer oldBuffer,
                                           int size)

write

public void write(byte data)
           throws java.io.IOException
Specified by:
write in interface Output
Throws:
java.io.IOException

write

public void write(Buffer bufferToWrite)
           throws java.io.IOException
Specified by:
write in interface Output
Throws:
java.io.IOException

isBuffered

public boolean isBuffered()
Specified by:
isBuffered in interface Output

getBuffer

public Buffer getBuffer()
Description copied from interface: Output
Return the Input's Buffer.

Specified by:
getBuffer in interface Output
Returns:
the Input's Buffer.

ensureBufferCapacity

public void ensureBufferCapacity(int size)
                          throws java.io.IOException
Specified by:
ensureBufferCapacity in interface Output
Throws:
java.io.IOException

flush

public GrizzlyFuture<java.lang.Integer> flush(CompletionHandler<java.lang.Integer> completionHandler)
                                       throws java.io.IOException
Description copied from interface: Output
Make sure that all data that has been written is flushed from the stream to its destination.

Specified by:
flush in interface Output
Throws:
java.io.IOException

close

public GrizzlyFuture<java.lang.Integer> close(CompletionHandler<java.lang.Integer> completionHandler)
                                       throws java.io.IOException
Description copied from interface: Output
Close the StreamWriter and make sure all data was flushed.

Specified by:
close in interface Output
Throws:
java.io.IOException

getBufferedSize

protected int getBufferedSize()


Copyright © 2012 Oracle Corporation. All Rights Reserved.