Package htsjdk.samtools.util
Class CoordSpanInputSteam
- java.lang.Object
-
- java.io.InputStream
-
- htsjdk.samtools.util.CoordSpanInputSteam
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class CoordSpanInputSteam extends InputStream
An input stream that wraps aSeekableStream
to produce only bytes specified within coordinates. Created by vadim on 25/03/2015.
-
-
Constructor Summary
Constructors Constructor Description CoordSpanInputSteam(SeekableStream delegate, long[] coords)
WrapSeekableStream
to read only bytes within boundaries specified in the coords array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
Returns how many bytes are left in the current chunk.void
close()
int
read()
int
read(byte[] buffer, int offset, int length)
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
CoordSpanInputSteam
public CoordSpanInputSteam(SeekableStream delegate, long[] coords) throws IOException
WrapSeekableStream
to read only bytes within boundaries specified in the coords array. The coords array consists of [inclusive; exclusive) pairs of long coordinates. This constructor will throw exception if a start coordinate is beyond stream length. End coordinates are capped at the stream length.- Throws:
IOException
-
-
Method Detail
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int length) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
available
public int available() throws IOException
Returns how many bytes are left in the current chunk.- Overrides:
available
in classInputStream
- Returns:
- number of unread bytes in the current chunk.
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
-