Module org.hsqldb

Class CountdownInputStream

java.lang.Object
java.io.InputStream
org.hsqldb.lib.CountdownInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public final class CountdownInputStream extends InputStream
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)