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
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longstatic final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidSubclasses may override.protected booleanlonglongvoidhandleBuffer(IBuffer buffer) Handles anIBufferand possibly releases it.booleanisCCAM()intread()intread(byte[] b, int off, int len) voidvoidsetException(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:IBufferHandlerHandles anIBufferand possibly releases it.The implementor of this method takes over the ownership of the buffer. Care must be taken to properly
releasethe buffer if the ownership is not explicitly passed on to some further party.- Specified by:
handleBufferin interfaceIBufferHandler- Parameters:
buffer- The buffer to be handled.
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
toString
-
ensureBuffer
- Throws:
IOException
-
closeChannel
protected void closeChannel()Subclasses may override.- Since:
- 4.5
-