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 a `SeekableStream` to produce only bytes specified within coordinates. Created by vadim on 25/03/2015.

## Constructor Summary

Constructors
Constructor
Description
`CoordSpanInputSteam(SeekableStream delegate, long[] coords)`
Wrap `SeekableStream` to read only bytes within boundaries specified in the coords array.

## Method Summary

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, skipNBytes, transferTo`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CoordSpanInputSteam

public CoordSpanInputSteam(SeekableStream delegate, long[] coords) throws IOException
Wrap `SeekableStream` 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 Details

### read

public int read() throws IOException

Specified by:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

public int read(byte[] buffer, int offset, int length) throws IOException

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### available

public int available() throws IOException
Returns how many bytes are left in the current chunk.

Overrides:
  `available` in class `InputStream`
Returns:
  number of unread bytes in the current chunk.
Throws:
  `IOException`

### close

public void close() throws IOException

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Overrides:
  `close` in class `InputStream`
Throws:
  `IOException`