org.apache.poi.util
Class BlockingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.poi.util.BlockingInputStream
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable
public class BlockingInputStream extends java.io.InputStreamImplementation 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.
-
-
Constructor Summary
Constructors Constructor and Description BlockingInputStream(java.io.InputStream is)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intavailable()voidclose()voidmark(int readLimit)booleanmarkSupported()intread()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)
-
-
-
Method Detail
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
mark
public void mark(int readLimit)
- Overrides:
markin classjava.io.InputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] bf) throws java.io.IOExceptionWe 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 classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] bf, int s, int l) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG