Class CountdownInputStream
java.lang.Object
java.io.InputStream
org.hsqldb.lib.CountdownInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
Counts down from a specified value the number of bytes actually read
from the wrapped InputStream.
Returns minus one (-1) early from readXXX methods if the count down reaches zero (0) before the end of the wrapped InputStream is encountered.
This class is especially useful when a fixed number of bytes is to be read
from an InputStream that is in turn to be used as the source for an
InputStreamReader.
- Since:
- 1.9.0
- Author:
- Campbell Burnet (campbell-burnet@users dot sourceforge.net)
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
CountdownInputStream
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
getCount
public long getCount() -
setCount
public void setCount(long count)
-