Package loci.common

Class 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
    • 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 class StreamHandle
        Throws:
        IOException - if the stream cannot be reset