Package ipsk.io
Class CuttingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- ipsk.io.FramedInputStream
-
- ipsk.io.FramedEditingInputStream
-
- ipsk.io.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
-
-
Field Summary
-
Fields inherited from class ipsk.io.FramedEditingInputStream
is
-
Fields inherited from class ipsk.io.FramedInputStream
frameSize, frameSizeException
-
-
Constructor Summary
Constructors Constructor Description CuttingInputStream(java.io.InputStream is, int frameSize, long off, long length)
Creates editing InputStream.CuttingInputStream(java.io.InputStream is, long off, long length)
Creates editing InputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
int
read(byte[] buf, int offset, int length)
long
skip(long n)
-
Methods inherited from class ipsk.io.FramedEditingInputStream
close
-
Methods inherited from class ipsk.io.FramedInputStream
read, read
-
-
-
-
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) InputStreamoff
- read data starts from this frame positionlength
- 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) InputStreamframeSize
- size of the data framesoff
- read data starts from this frame positionlength
- read length frames
-
-
Method Detail
-
read
public int read(byte[] buf, int offset, int length) throws java.io.IOException
- Specified by:
read
in classFramedInputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-