Package org.eclipse.net4j.buffer
Class BufferOutputStream
- java.lang.Object
- 
- java.io.OutputStream
- 
- org.eclipse.net4j.buffer.BufferOutputStream
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.io.Flushable,- java.lang.AutoCloseable
 - Direct Known Subclasses:
- ChannelOutputStream
 
 public class BufferOutputStream extends java.io.OutputStreamAnoutput streamthat fragments the written byte sequence into fixed-sizedbuffersand passes them to configuredbuffer handler.- Author:
- Eike Stepper
 
- 
- 
Field SummaryFields Modifier and Type Field Description static booleanDEFAULT_PROPAGATE_CLOSE
 - 
Constructor SummaryConstructors Constructor Description BufferOutputStream(IBufferHandler bufferHandler, short channelID)BufferOutputStream(IBufferHandler bufferHandler, IBufferProvider bufferProvider, short channelID)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidensureBuffer()Ensures that this BufferOutputStream has a buffer.voidflush()Flushes the current buffer, it's handled over to the buffer handler.voidflushWithEOS()voidflushWithEOS(boolean ccam)java.lang.ThrowablegetError()protected booleanisPropagateClose()voidsetError(java.lang.Throwable error)java.lang.StringtoString()voidwrite(byte[] b, int off, int len)voidwrite(int b)
 
- 
- 
- 
Field Detail- 
DEFAULT_PROPAGATE_CLOSEpublic static final boolean DEFAULT_PROPAGATE_CLOSE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
BufferOutputStreampublic BufferOutputStream(IBufferHandler bufferHandler, IBufferProvider bufferProvider, short channelID) 
 - 
BufferOutputStreampublic BufferOutputStream(IBufferHandler bufferHandler, short channelID) 
 
- 
 - 
Method Detail- 
getErrorpublic java.lang.Throwable getError() - Since:
- 2.0
 
 - 
setErrorpublic void setError(java.lang.Throwable error) - Since:
- 2.0
 
 - 
writepublic void write(int b) throws java.io.IOException- Specified by:
- writein class- java.io.OutputStream
- Throws:
- java.io.IOException
 
 - 
writepublic void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
- writein class- java.io.OutputStream
- Throws:
- java.io.IOException
 
 - 
flushpublic void flush() throws java.io.IOExceptionFlushes the current buffer, it's handled over to the buffer handler.- Specified by:
- flushin interface- java.io.Flushable
- Overrides:
- flushin class- java.io.OutputStream
- Throws:
- java.io.IOException- Signals that an I/O exception has occurred.
- See Also:
- currentBuffer,- IBufferHandler.handleBuffer(IBuffer)
 
 - 
flushWithEOSpublic void flushWithEOS() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
flushWithEOSpublic void flushWithEOS(boolean ccam) throws java.io.IOException- Throws:
- java.io.IOException
- Since:
- 4.4
 
 - 
closepublic void close() throws java.io.IOException- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Overrides:
- closein class- java.io.OutputStream
- Throws:
- java.io.IOException
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
ensureBufferprotected void ensureBuffer() throws java.io.IOExceptionEnsures that this BufferOutputStream has a buffer. If the current buffer was flushed a new one is fetched from the buffer provider.- Throws:
- java.io.IOException- Signals that an I/O exception has occurred.
- See Also:
- flush(),- IBufferProvider.provideBuffer()
 
 - 
isPropagateCloseprotected boolean isPropagateClose() 
 
- 
 
-