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 aSeekableStreamto produce only bytes specified within coordinates. Created by vadim on 25/03/2015.
-
-
Constructor Summary
Constructors Constructor Description CoordSpanInputSteam(SeekableStream delegate, long[] coords)WrapSeekableStreamto read only bytes within boundaries specified in the coords array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()Returns how many bytes are left in the current chunk.voidclose()intread()intread(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
WrapSeekableStreamto 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:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] buffer, int offset, int length) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
available
public int available() throws IOExceptionReturns how many bytes are left in the current chunk.- Overrides:
availablein classInputStream- Returns:
- number of unread bytes in the current chunk.
- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-