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 java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
CountdownInputStream
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
getCount
public long getCount() -
setCount
public void setCount(long count)
-