Documentation of 'org.hsqldb.lib.CountdownInputStream' Java class
CountdownInputStream
org.hsqldb.lib

Class CountdownInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable


    public final class CountdownInputStream
    extends java.io.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
    • Constructor Summary

      Constructors 
      Constructor and Description
      CountdownInputStream(java.io.InputStream is) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int available() 
      void close() 
      long getCount() 
      int read() 
      int read(byte[] buf) 
      int read(byte[] buf, int off, int len) 
      void setCount(long count) 
      long skip(long count) 
      • Methods inherited from class java.io.InputStream

        mark, markSupported, reset
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CountdownInputStream

        public CountdownInputStream(java.io.InputStream is)
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read(byte[] buf)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read(byte[] buf,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip(long count)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
      • getCount

        public long getCount()
      • setCount

        public void setCount(long count)

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.