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 IntervalCodec
clone()
Must return a cloned copy of the codec that can be used independently of the original instance.Interval
decode()
Reads an interval from the input stream.void
encode(Interval interval)
Writes the interval to the output stream.void
setInputStream(InputStream is)
Sets the input stream that records will be read from.void
setInputStream(InputStream is, String filename)
Sets the input stream that records will be read from.void
setOutputStream(OutputStream os)
Sets the output stream that records will be written to.void
setOutputStream(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.Codec
Must 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:
clone
in interfaceSortingCollection.Codec<Interval>
- Overrides:
clone
in classObject
-
setOutputStream
public void setOutputStream(OutputStream os)
Sets the output stream that records will be written to.- Specified by:
setOutputStream
in 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:
setInputStream
in 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:
encode
in interfaceSortingCollection.Codec<Interval>
- Parameters:
interval
- the interval to write.
-
decode
public Interval decode()
Reads an interval from the input stream.- Specified by:
decode
in interfaceSortingCollection.Codec<Interval>
- Returns:
- null if no more intervals, otherwise the next interval.
-
-