Package org.eclipse.net4j.buffer
Class BufferInputStream
java.lang.Object
java.io.InputStream
org.eclipse.net4j.buffer.BufferInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IBufferHandler
- Direct Known Subclasses:
ChannelInputStream
A
buffer handler
that defragments the passed buffers
into a continuous byte
sequence which is exposed as an input stream
.- Author:
- Eike Stepper
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
static final long
static final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
Subclasses may override.protected boolean
long
long
void
handleBuffer
(IBuffer buffer) Handles anIBuffer
and possibly releases it.boolean
isCCAM()
int
read()
int
read
(byte[] b, int off, int len) void
void
setException
(RemoteException exception) toString()
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
NO_TIMEOUT
public static final long NO_TIMEOUT- See Also:
-
DEFAULT_MILLIS_BEFORE_TIMEOUT
public static final long DEFAULT_MILLIS_BEFORE_TIMEOUT- See Also:
-
DEFAULT_MILLIS_INTERRUPT_CHECK
public static final long DEFAULT_MILLIS_INTERRUPT_CHECK- See Also:
-
-
Constructor Details
-
BufferInputStream
public BufferInputStream()
-
-
Method Details
-
isCCAM
public boolean isCCAM()- Since:
- 4.4
-
getMillisBeforeTimeout
public long getMillisBeforeTimeout() -
getMillisInterruptCheck
public long getMillisInterruptCheck() -
restartTimeout
public void restartTimeout()- Since:
- 2.0
-
getException
- Since:
- 2.0
-
setException
- Since:
- 4.0
-
handleBuffer
Description copied from interface:IBufferHandler
Handles anIBuffer
and possibly releases it.The implementor of this method takes over the ownership of the buffer. Care must be taken to properly
release
the buffer if the ownership is not explicitly passed on to some further party.- Specified by:
handleBuffer
in interfaceIBufferHandler
- Parameters:
buffer
- The buffer to be handled.
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
toString
-
ensureBuffer
- Throws:
IOException
-
closeChannel
protected void closeChannel()Subclasses may override.- Since:
- 4.5
-