Package htsjdk.samtools.util
Interface LocationAware
- All Known Subinterfaces:
Positional
- All Known Implementing Classes:
AsciiLineReader
,AsciiLineReaderIterator
,AsyncBlockCompressedInputStream
,BlockCompressedInputStream
,BlockCompressedOutputStream
,PositionalBufferedStream
,PositionalOutputStream
,TerminatorlessBlockCompressedOutputStream
public interface LocationAware
Describes API for getting current position in a stream, writer, or underlying file.
The expected functionality is simple: if you are a output stream / writer, and you've written 50 bytes to the stream, then
getPosition()
should return 50; if you are an input stream or file reader, and you've read 25 bytes from the object, then it
should return 25.
In the context of an iterator or any producer-like object that doesn't map directly to a byte stream, getPosition()
should
return the position (in the underlying stream being read/written to) of the most-recently read/written element. For example, if you
are reading lines from a file with a AsciiLineReaderIterator
, calling getPosition()
should return the byte position
of the start of the most recent line returned by AsciiLineReaderIterator.next()
.-
Method Summary
Modifier and TypeMethodDescriptionlong
The current offset, in bytes, of this stream/writer/file.
-
Method Details
-
getPosition
long getPosition()The current offset, in bytes, of this stream/writer/file. Or, if this is an iterator/producer, the offset (in bytes) of the END of the most recently returned record (since a produced record corresponds to something that has been read already). See class javadoc for more. Note that for BGZF files, this does not represent an actually file position, but a virtual file pointer.
-