Package htsjdk.samtools.util
Class IntervalCodec
- java.lang.Object
-
- htsjdk.samtools.util.IntervalCodec
-
- All Implemented Interfaces:
SortingCollection.Codec<Interval>,Cloneable
public class IntervalCodec extends Object implements SortingCollection.Codec<Interval>
-
-
Constructor Summary
Constructors Constructor Description IntervalCodec(SAMSequenceDictionary dict)Creates a new binary codec to read or write.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IntervalCodecclone()Must return a cloned copy of the codec that can be used independently of the original instance.Intervaldecode()Reads an interval from the input stream.voidencode(Interval interval)Writes the interval to the output stream.voidsetInputStream(InputStream is)Sets the input stream that records will be read from.voidsetInputStream(InputStream is, String filename)Sets the input stream that records will be read from.voidsetOutputStream(OutputStream os)Sets the output stream that records will be written to.voidsetOutputStream(OutputStream os, String filename)Sets the output stream that records will be written to.
-
-
-
Constructor Detail
-
IntervalCodec
public IntervalCodec(SAMSequenceDictionary dict)
Creates a new binary codec to read or write.- Parameters:
dict- the sequence dictionary associated with the intervals.
-
-
Method Detail
-
clone
public IntervalCodec clone()
Description copied from interface:SortingCollection.CodecMust return a cloned copy of the codec that can be used independently of the original instance. This is required so that multiple codecs can exist simultaneously that each is reading a separate file.- Specified by:
clonein interfaceSortingCollection.Codec<Interval>- Overrides:
clonein classObject
-
setOutputStream
public void setOutputStream(OutputStream os)
Sets the output stream that records will be written to.- Specified by:
setOutputStreamin interfaceSortingCollection.Codec<Interval>
-
setOutputStream
public void setOutputStream(OutputStream os, String filename)
Sets the output stream that records will be written to.
-
setInputStream
public void setInputStream(InputStream is)
Sets the input stream that records will be read from.- Specified by:
setInputStreamin interfaceSortingCollection.Codec<Interval>
-
setInputStream
public void setInputStream(InputStream is, String filename)
Sets the input stream that records will be read from.
-
encode
public void encode(Interval interval)
Writes the interval to the output stream.- Specified by:
encodein interfaceSortingCollection.Codec<Interval>- Parameters:
interval- the interval to write.
-
decode
public Interval decode()
Reads an interval from the input stream.- Specified by:
decodein interfaceSortingCollection.Codec<Interval>- Returns:
- null if no more intervals, otherwise the next interval.
-
-