Package loci.poi.util
Class BlockingInputStream
java.lang.Object
java.io.InputStream
loci.poi.util.BlockingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Implementation of a BlockingInputStream to provide data to
RawDataBlock that expects data in 512 byte chunks. Useful to read
data from slow (ie, non FileInputStream) sources, for example when
reading an OLE2 Document over a network.
Possible extentions: add a timeout. Curently a call to read(byte[]) on this
class is blocking, so use at your own peril if your underlying stream blocks.
- Author:
- Jens Gerhard, aviks - documentation cleanups.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()voidmark(int readLimit) booleanintread()intread(byte[] bf) We had to revert to byte per byte reading to keep with slow network connections on one hand, without missing the end-of-file.intread(byte[] bf, int s, int l) voidreset()longskip(long n) Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
is
-
-
Constructor Details
-
BlockingInputStream
-
-
Method Details
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int readLimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
We had to revert to byte per byte reading to keep with slow network connections on one hand, without missing the end-of-file. This is the only method that does its own thing in this class everything else is delegated to aggregated stream. THIS IS A BLOCKING BLOCK READ!!!- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-