Package org.eclipse.net4j.buffer
Class BufferOutputStream
java.lang.Object
java.io.OutputStream
org.eclipse.net4j.buffer.BufferOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
ChannelOutputStream
An
output stream
that fragments the written byte sequence into fixed-sized buffers
and passes them to configured buffer handler
.- Author:
- Eike Stepper
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBufferOutputStream
(IBufferHandler bufferHandler, short channelID) BufferOutputStream
(IBufferHandler bufferHandler, IBufferProvider bufferProvider, short channelID) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
Ensures that this BufferOutputStream has a buffer.void
flush()
Flushes the current buffer, it's handled over to the buffer handler.void
void
flushWithEOS
(boolean ccam) getError()
protected boolean
void
toString()
void
write
(byte[] b, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
DEFAULT_PROPAGATE_CLOSE
public static final boolean DEFAULT_PROPAGATE_CLOSE- See Also:
-
-
Constructor Details
-
BufferOutputStream
public BufferOutputStream(IBufferHandler bufferHandler, IBufferProvider bufferProvider, short channelID) -
BufferOutputStream
-
-
Method Details
-
getError
- Since:
- 2.0
-
setError
- Since:
- 2.0
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
Flushes the current buffer, it's handled over to the buffer handler.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
- Signals that an I/O exception has occurred.- See Also:
-
currentBuffer
IBufferHandler.handleBuffer(IBuffer)
-
flushWithEOS
- Throws:
IOException
-
flushWithEOS
- Throws:
IOException
- Since:
- 4.4
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
toString
-
ensureBuffer
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:
-
isPropagateClose
protected boolean isPropagateClose()
-