Package htsjdk.tribble

# Class AbstractFeatureReader<T extends Feature,SOURCE>

java.lang.Object
htsjdk.tribble.AbstractFeatureReader<T,SOURCE>

All Implemented Interfaces:
  `FeatureReader<T>`, `Closeable`, `AutoCloseable`

Direct Known Subclasses:
  `TabixFeatureReader`, `TribbleIndexedFeatureReader`

public abstract class AbstractFeatureReader<T extends Feature,SOURCE> extends Object implements FeatureReader<T>
jrobinso

the feature reader class, which uses indices and codecs to read in Tribble file formats.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`AbstractFeatureReader.ComponentMethods`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final Set<String>`
`BLOCK_COMPRESSED_EXTENSIONS`
Deprecated.
since June 2019 use `FileExtensions.BLOCK_COMPRESSED` instead.
`protected final FeatureCodec<T,SOURCE>`
`codec`
`protected FeatureCodecHeader`
`header`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec)`
`protected`
`AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper)`

## Method Summary

Modifier and Type
Method
Description
`static <FEATURE extends Feature, SOURCE>
AbstractFeatureReader<FEATURE,SOURCE>`
`getFeatureReader(String featureFile, FeatureCodec<FEATURE,SOURCE> codec)`
Calls `getFeatureReader(String, FeatureCodec, boolean)` with `requireIndex` = true
`static <FEATURE extends Feature, SOURCE>
AbstractFeatureReader<FEATURE,SOURCE>`
`getFeatureReader(String featureResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex)`
`getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)` with `null` for indexResource, wrapper, and indexWrapper
`static <FEATURE extends Feature, SOURCE>
AbstractFeatureReader<FEATURE,SOURCE>`
`getFeatureReader(String featureResource, FeatureCodec<FEATURE,SOURCE> codec, Index index)`
Return a reader with a supplied index.
`static <FEATURE extends Feature, SOURCE>
AbstractFeatureReader<FEATURE,SOURCE>`
`getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex)`
`getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)` with `null` for wrapper, and indexWrapper
`static <FEATURE extends Feature, SOURCE>
AbstractFeatureReader<FEATURE,SOURCE>`
`getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper)`
`Object`
`getHeader()`
get the header
`static boolean`
`hasBlockCompressedExtension(File file)`
Deprecated.
use `IOUtil.hasBlockCompressedExtension(File)`.
`static boolean`
`hasBlockCompressedExtension(String fileName)`
Deprecated.
use `IOUtil.hasBlockCompressedExtension(String)`.
`static boolean`
`hasBlockCompressedExtension(URI uri)`
Deprecated.
use `IOUtil.hasBlockCompressedExtension(URI)`.
`boolean`
`hasIndex()`
Whether the reader has an index or not Default implementation returns false
`boolean`
`isQueryable()`
`static boolean`
`isTabix(String resourcePath, String indexPath)`
`static void`
`setComponentMethods(AbstractFeatureReader.ComponentMethods methods)`

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

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

### Methods inherited from interface htsjdk.tribble.FeatureReader

`close, getSequenceNames, iterator, query, query`

## Field Details

### codec

protected final FeatureCodec<T extends Feature,SOURCE> codec

### header

protected FeatureCodecHeader header

### BLOCK_COMPRESSED_EXTENSIONS

@Deprecated public static final Set<String> BLOCK_COMPRESSED_EXTENSIONS
Deprecated.
since June 2019 use `FileExtensions.BLOCK_COMPRESSED` instead.

## Constructor Details

### AbstractFeatureReader

protected AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec)

### AbstractFeatureReader

protected AbstractFeatureReader(String path, FeatureCodec<T,SOURCE> codec, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper)

## Method Details

### getFeatureReader

public static <FEATURE extends Feature, SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureFile, FeatureCodec<FEATURE,SOURCE> codec) throws TribbleException
Calls `getFeatureReader(String, FeatureCodec, boolean)` with `requireIndex` = true

Throws:
  `TribbleException`

### getFeatureReader

public static <FEATURE extends Feature, SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex) throws TribbleException
`getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)` with `null` for indexResource, wrapper, and indexWrapper

Throws:
  `TribbleException`

### getFeatureReader

public static <FEATURE extends Feature, SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex) throws TribbleException
`getFeatureReader(String, String, FeatureCodec, boolean, Function, Function)` with `null` for wrapper, and indexWrapper

Throws:
  `TribbleException`

### getFeatureReader

public static <FEATURE extends Feature, SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, String indexResource, FeatureCodec<FEATURE,SOURCE> codec, boolean requireIndex, Function<SeekableByteChannel,SeekableByteChannel> wrapper, Function<SeekableByteChannel,SeekableByteChannel> indexWrapper) throws TribbleException

Parameters:
  `featureResource` - the feature file to create from
  `indexResource` - the index for the feature file. If null, will auto-generate (if necessary)
  `codec` - the codec to use to decode the individual features
  `requireIndex` - whether an index is required for this file
  `wrapper` - a wrapper to apply to the byte stream from the featureResource allowing injecting features like caching and prefetching of the stream, may be null, will only be applied if featureResource is a uri representing a `Path`
  `indexWrapper` - a wrapper to apply to the byte stream from the indexResource, may be null, will only be applied if indexResource is a uri representing a `Path`
Throws:
  `TribbleException`

### getFeatureReader

public static <FEATURE extends Feature, SOURCE> AbstractFeatureReader<FEATURE,SOURCE> getFeatureReader(String featureResource, FeatureCodec<FEATURE,SOURCE> codec, Index index) throws TribbleException
Return a reader with a supplied index.

Parameters:
  `featureResource` - the path to the source file containing the features
  `codec` - used to decode the features
  `index` - index of featureResource
Returns:
  a reader for this data
Throws:
  `TribbleException`

### hasIndex

public boolean hasIndex()
Whether the reader has an index or not Default implementation returns false

Returns:
  false

### isQueryable

public boolean isQueryable()

Specified by:
  `isQueryable` in interface `FeatureReader<T extends Feature>`
Returns:
  true if the reader has an index, which means that it can be queried.

### setComponentMethods

public static void setComponentMethods(AbstractFeatureReader.ComponentMethods methods)

### hasBlockCompressedExtension

@Deprecated public static boolean hasBlockCompressedExtension(String fileName)
Deprecated.
use `IOUtil.hasBlockCompressedExtension(String)`.

### hasBlockCompressedExtension

@Deprecated public static boolean hasBlockCompressedExtension(File file)
Deprecated.
use `IOUtil.hasBlockCompressedExtension(File)`.

### hasBlockCompressedExtension

@Deprecated public static boolean hasBlockCompressedExtension(URI uri)
Deprecated.
use `IOUtil.hasBlockCompressedExtension(URI)`.

### getHeader

public Object getHeader()
get the header

Specified by:
  `getHeader` in interface `FeatureReader<T extends Feature>`
Returns:
  the header object we've read-in

### isTabix

public static boolean isTabix(String resourcePath, String indexPath) throws IOException

Throws:
  `IOException`