Package blbutil
Class BGZipIt
java.lang.Object
blbutil.BGZipIt
Class BGZipIt is a blbutil.FileIt<String> whose
next() method returns lines of a bgzip-compressed file.
The GZIP file format specification is described RFC 1952 and the BGZIP file format specification is described in the Sequence Alignment/Map Format Specification
Instances of class BGZipIt are not thread safe.
-
Constructor Summary
ConstructorsConstructorDescriptionBGZipIt(InputStream is, int nBufferedBlocks) Constructs a newBGZipItinstance from the specified dataBGZipIt(InputStream is, int nBufferedBlocks, File source) Constructs a newBGZipItinstance from the specified data -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstrueif the first 16 bytes of the specified input stream are a gzip header that includes a 6 byte extra field containing the block size as described in the bgzip specification, and returnsfalseotherwise.voidclose()Closes the input stream and releases any system resources that are associated with it.file()Returns the file from which the data are read, ornullif the data are read from standard input or if the data source is unknown.booleanhasNext()Returnstrueif the iteration has more elements.next()Returns the next line of the VCF file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
BGZipIt
Constructs a newBGZipItinstance from the specified data- Parameters:
is- an input stream that reads from a gzip-compressed VCF filenBufferedBlocks- the number of buffered gzip blocks- Throws:
IllegalArgumentException- ifnBufferedBlocks < 1NullPointerException- ifis == null
-
BGZipIt
Constructs a newBGZipItinstance from the specified data- Parameters:
is- an input stream that reads gzip-compressed VCF datanBufferedBlocks- the number of buffered gzip blockssource- the gzip-compressed VCF file that is read- Throws:
IllegalArgumentException- ifnBufferedBlocks < 1NullPointerException- ifis == null
-
-
Method Details
-
close
public void close()Description copied from interface:FileItCloses the input stream and releases any system resources that are associated with it. If the input stream is already closed then invoking this method has no effect. -
hasNext
public boolean hasNext()Returnstrueif the iteration has more elements. -
next
Returns the next line of the VCF file. End of line characters are not included in the returned line.- Specified by:
nextin interfaceIterator<String>- Returns:
- the next line of the VCF file
- Throws:
NoSuchElementException- if the VCF file has no more lines
-
file
Description copied from interface:FileItReturns the file from which the data are read, ornullif the data are read from standard input or if the data source is unknown. -
beginsWithBgzipBlock
Returnstrueif the first 16 bytes of the specified input stream are a gzip header that includes a 6 byte extra field containing the block size as described in the bgzip specification, and returnsfalseotherwise. The method sets a mark before reading the initial bytes from the stream, and resets the stream to the mark position before returning.- Parameters:
bis- a buffered input stream- Returns:
trueif the first 16 bytes of the specified input stream are a gzip header that includes a 6 byte extra field containing the block size as described in the bgzip specification
-