org.eclipse.net4j.buffer
Class BufferOutputStream
java.lang.Object
java.io.OutputStream
org.eclipse.net4j.buffer.BufferOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
- Direct Known Subclasses:
- ChannelOutputStream
- public class BufferOutputStream
- extends OutputStream
An output stream
that fragments the written byte sequence into fixed-sized buffers
and passes them to configured buffer handler
.
DEFAULT_PROPAGATE_CLOSE
public static final boolean DEFAULT_PROPAGATE_CLOSE
- See Also:
- Constant Field Values
BufferOutputStream
public BufferOutputStream(IBufferHandler bufferHandler,
IBufferProvider bufferProvider,
short channelID)
BufferOutputStream
public BufferOutputStream(IBufferHandler bufferHandler,
short channelID)
getError
public Throwable getError()
- Since:
- 2.0
setError
public void setError(Throwable error)
- Since:
- 2.0
write
public void write(int b)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Flushes the current buffer, it's handled over to the buffer handler.
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream
- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
currentBuffer
,
IBufferHandler.handleBuffer(IBuffer)
flushWithEOS
public void flushWithEOS()
throws IOException
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
toString
public String toString()
- Overrides:
toString
in class Object
ensureBuffer
protected void ensureBuffer()
throws IOException
- Ensures that this BufferOutputStream has a buffer. If the current buffer was flushed a new one is fetched from the
buffer provider.
- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
flush()
,
IBufferProvider.provideBuffer()
isPropagateClose
protected boolean isPropagateClose()
Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.