Package ipsk.io

Class CuttingInputStream

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

    public class CuttingInputStream
    extends FramedEditingInputStream
    This stream reads a segment of the underlying input stream.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Constructor Detail

      • CuttingInputStream

        public CuttingInputStream​(java.io.InputStream is,
                                  long off,
                                  long length)
        Creates editing InputStream. Only the data bytes from the given position with the given length of the underlying InputStream are read. (the bytes from 'off' to 'off+length')
        Parameters:
        is - the underlying (source) InputStream
        off - read data starts from this frame position
        length - read length frames
      • CuttingInputStream

        public CuttingInputStream​(java.io.InputStream is,
                                  int frameSize,
                                  long off,
                                  long length)
        Creates editing InputStream. Only the data frames from the given position with the given length of the underlying InputStream are read. (the bytes from 'off * frameSize' to '(off+length) * frameSize')
        Parameters:
        is - the underlying (source) InputStream
        frameSize - size of the data frames
        off - read data starts from this frame position
        length - read length frames
    • Method Detail

      • read

        public int read​(byte[] buf,
                        int offset,
                        int length)
                 throws java.io.IOException
        Specified by:
        read in class FramedInputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip 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