Package loci.common
Class BZip2Handle
java.lang.Object
loci.common.StreamHandle
loci.common.BZip2Handle
- All Implemented Interfaces:
java.io.DataInput
,java.io.DataOutput
,IRandomAccess
public class BZip2Handle extends StreamHandle
StreamHandle implementation for reading from BZip2-compressed files
or byte arrays. Instances of BZip2Handle are read-only.
- Author:
- Melissa Linkert melissa at glencoesoftware.com
- See Also:
StreamHandle
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BZip2Handle(java.lang.String file)
Construct a new BZip2Handle corresponding to the given file. -
Method Summary
Modifier and Type Method Description static boolean
isBZip2File(java.lang.String file)
Returns true if the given filename is a BZip2 file.protected void
resetStream()
Close and reopen the stream; the stream pointer and mark should be reset to 0.Methods inherited from class loci.common.StreamHandle
close, exists, getFilePointer, getOrder, length, read, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setOrder, skipBytes, skipBytes, write, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Constructor Details
-
BZip2Handle
public BZip2Handle(java.lang.String file) throws java.io.IOExceptionConstruct a new BZip2Handle corresponding to the given file.- Parameters:
file
- the path to a file on disk- Throws:
HandleException
- if the given file is not a BZip2 file.java.io.IOException
-
-
Method Details
-
isBZip2File
public static boolean isBZip2File(java.lang.String file) throws java.io.IOExceptionReturns true if the given filename is a BZip2 file.- Parameters:
file
- the path to a file on disk- Returns:
- true if file's extension is .bz2 and the first 2 bytes are the BZip2 magic marker
- Throws:
java.io.IOException
- if the file is not readable
-
resetStream
protected void resetStream() throws java.io.IOExceptionDescription copied from class:StreamHandle
Close and reopen the stream; the stream pointer and mark should be reset to 0. This method is called if we need to seek backwards within the stream.- Specified by:
resetStream
in classStreamHandle
- Throws:
java.io.IOException
- if the stream cannot be reset
-