# Class ByteArraySeekableStream

java.lang.Object
java.io.InputStream
htsjdk.samtools.seekablestream.SeekableStream
htsjdk.samtools.seekablestream.ByteArraySeekableStream

All Implemented Interfaces:
  `Closeable, AutoCloseable`

public class ByteArraySeekableStream extends SeekableStream
Created by vadim on 23/03/2015.

## Field Summary

### Fields inherited from class SeekableStream

`mark`

## Constructor Summary

Constructors
Constructor
Description
`ByteArraySeekableStream(byte[] bytes)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
`boolean`
`eof()`
`String`
`getSource()`
`long`
`length()`
`long`
`position()`
`int`
`read()`
`int`
`read(byte[] b, int off, int len)`
`void`
`seek(long position)`
Seeks the stream to the provided position.

### Methods inherited from class SeekableStream

`available, mark, markSupported, readFully, reset`

### Methods inherited from class InputStream

`nullInputStream, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo`

### Methods inherited from class Object

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

## Constructor Details

### ByteArraySeekableStream

public ByteArraySeekableStream(byte[] bytes)

## Method Details

### length

public long length()

Specified by:
  `length` in class `SeekableStream`
Returns:
  the length of the stream; 0 if not available or empty.

### position

public long position() throws IOException

Specified by:
  `position` in class `SeekableStream`
Returns:
  the current byte position of the stream.
Throws:
  `IOException`

### seek

public void seek(long position) throws IOException
Description copied from class: `SeekableStream`
Seeks the stream to the provided position.

Specified by:
  `seek` in class `SeekableStream`
Throws:
  `IOException`

### read

public int read() throws IOException

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

### read

public int read(byte[] b, int off, int len) throws IOException

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

### close

public void close() throws IOException

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

### eof

public boolean eof() throws IOException

Specified by:
  `eof` in class `SeekableStream`
Returns:
  `true` if the stream is already consumed; `false` otherwise.
Throws:
  `IOException`

### getSource

public String getSource()

Specified by:
  `getSource` in class `SeekableStream`
Returns:
  String representation of source (e.g. URL, file path, etc.), or null if not available.