T
- The feature type this codec readsFeatureCodec<T,LineIterator>
AbstractVCFCodec
, BEDCodec
public abstract class AsciiFeatureCodec<T extends Feature> extends AbstractFeatureCodec<T,LineIterator>
Modifier | Constructor | Description |
---|---|---|
protected |
AsciiFeatureCodec(Class<T> myClass) |
Modifier and Type | Method | Description |
---|---|---|
void |
close(LineIterator lineIterator) |
Adapter method that closes the provided
FeatureCodec . |
T |
decode(LineIterator lineIterator) |
Convenience method.
|
abstract T |
decode(String s) |
|
boolean |
isDone(LineIterator lineIterator) |
Adapter method that assesses whether the provided
FeatureCodec has more data. |
LocationAware |
makeIndexableSourceFromStream(InputStream inputStream) |
Return a
FeatureCodec for this FeatureCodec that implements LocationAware ,
and is thus suitable for use during indexing. |
LineIterator |
makeSourceFromStream(InputStream bufferedInputStream) |
Generates a reader of type
FeatureCodec appropriate for use by this codec from the generic input stream. |
abstract Object |
readActualHeader(LineIterator reader) |
Read and return the header, or null if there is no header.
|
FeatureCodecHeader |
readHeader(LineIterator lineIterator) |
Read and return the header, or null if there is no header.
|
decodeLoc, getFeatureType
canDecode, getTabixFormat
public void close(LineIterator lineIterator)
FeatureCodec
FeatureCodec
.public boolean isDone(LineIterator lineIterator)
FeatureCodec
FeatureCodec
has more data. True if it does, false otherwise.public LocationAware makeIndexableSourceFromStream(InputStream inputStream)
FeatureCodec
FeatureCodec
for this FeatureCodec
that implements LocationAware
,
and is thus suitable for use during indexing. Like FeatureCodec.makeSourceFromStream(java.io.InputStream)
, except
the LocationAware
compatibility is required for creating indexes.
Implementers of this method must return a type that is both LocationAware
as well as FeatureCodec
. Note that this
requirement cannot be enforced via the method signature due to limitations in Java's generic typing system. Instead, consumers
should cast the call result into a FeatureCodec
when applicable.
NOTE: During the indexing process, the indexer passes the FeatureCodec
to the codec
to consume Features from the underlying FeatureCodec
, one at a time, recording the Feature location via the FeatureCodec
's
LocationAware
interface. Therefore, it is essential that the FeatureCodec
implementation, the FeatureCodec.readHeader(SOURCE)
method, and the FeatureCodec.decodeLoc(SOURCE)
method, which are used during indexing, not introduce any buffering that would that
would advance the FeatureCodec
more than a single feature (or the more than the size of the header, in the case of
FeatureCodec.readHeader(SOURCE)
).public LineIterator makeSourceFromStream(InputStream bufferedInputStream)
FeatureCodec
FeatureCodec
appropriate for use by this codec from the generic input stream. Implementers should
assume the stream is buffered.public T decode(LineIterator lineIterator)
Iterator.next()
in implementing classes and, instead, have them implement
decode(String)
.lineIterator
- the input stream from which to decode the next recordpublic FeatureCodecHeader readHeader(LineIterator lineIterator) throws IOException
FeatureCodec
FeatureCodec
as needed to parse the header, and no
more. Otherwise, data that might otherwise be fed into parsing a Feature
may be lost.lineIterator
- the source from which to decode the headerIOException
public abstract Object readActualHeader(LineIterator reader)