Package org.eclipse.net4j.buffer
Class BufferInputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- org.eclipse.net4j.buffer.BufferInputStream
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable,- IBufferHandler
 - Direct Known Subclasses:
- ChannelInputStream
 
 public class BufferInputStream extends java.io.InputStream implements IBufferHandler Abuffer handlerthat defragments the passedbuffersinto a continuous byte sequence which is exposed as aninput stream.- Author:
- Eike Stepper
 
- 
- 
Field SummaryFields Modifier and Type Field Description static longDEFAULT_MILLIS_BEFORE_TIMEOUTstatic longDEFAULT_MILLIS_INTERRUPT_CHECKstatic longNO_TIMEOUT
 - 
Constructor SummaryConstructors Constructor Description BufferInputStream()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidcloseChannel()Subclasses may override.protected booleanensureBuffer()java.lang.RuntimeExceptiongetException()longgetMillisBeforeTimeout()longgetMillisInterruptCheck()voidhandleBuffer(IBuffer buffer)Handles anIBufferand possibly releases it.booleanisCCAM()intread()intread(byte[] b, int off, int len)voidrestartTimeout()voidsetException(RemoteException exception)java.lang.StringtoString()
 
- 
- 
- 
Field Detail- 
NO_TIMEOUTpublic static final long NO_TIMEOUT - See Also:
- Constant Field Values
 
 - 
DEFAULT_MILLIS_BEFORE_TIMEOUTpublic static final long DEFAULT_MILLIS_BEFORE_TIMEOUT - See Also:
- Constant Field Values
 
 - 
DEFAULT_MILLIS_INTERRUPT_CHECKpublic static final long DEFAULT_MILLIS_INTERRUPT_CHECK - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
isCCAMpublic boolean isCCAM() - Since:
- 4.4
 
 - 
getMillisBeforeTimeoutpublic long getMillisBeforeTimeout() 
 - 
getMillisInterruptCheckpublic long getMillisInterruptCheck() 
 - 
restartTimeoutpublic void restartTimeout() - Since:
- 2.0
 
 - 
getExceptionpublic java.lang.RuntimeException getException() - Since:
- 2.0
 
 - 
setExceptionpublic void setException(RemoteException exception) - Since:
- 4.0
 
 - 
handleBufferpublic void handleBuffer(IBuffer buffer) 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 interface- IBufferHandler
- Parameters:
- buffer- The buffer to be handled.
 
 - 
readpublic int read() throws java.io.IOException- Specified by:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
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.InputStream
- Throws:
- java.io.IOException
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
ensureBufferprotected boolean ensureBuffer() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
closeChannelprotected void closeChannel() Subclasses may override.- Since:
- 4.5
 
 
- 
 
-