Package loci.common
Class BZip2Handle
- java.lang.Object
-
- loci.common.StreamHandle
-
- loci.common.BZip2Handle
-
- All Implemented Interfaces:
DataInput
,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
-
Nested classes/interfaces inherited from class loci.common.StreamHandle
StreamHandle.Settings
-
-
Constructor Summary
Constructors Constructor Description BZip2Handle(String file)
Construct a new BZip2Handle corresponding to the given file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
isBZip2File(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 Detail
-
BZip2Handle
public BZip2Handle(String file) throws IOException
Construct 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.IOException
-
-
Method Detail
-
isBZip2File
public static boolean isBZip2File(String file) throws IOException
Returns 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:
IOException
- if the file is not readable
-
resetStream
protected void resetStream() throws IOException
Description 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:
IOException
- if the stream cannot be reset
-
-