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
  • Constructor Details

    • BZip2Handle

      public BZip2Handle​(java.lang.String file) throws java.io.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.
      java.io.IOException
  • Method Details

    • isBZip2File

      public static boolean isBZip2File​(java.lang.String file) throws java.io.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:
      java.io.IOException - if the file is not readable
    • resetStream

      protected void resetStream() throws java.io.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:
      java.io.IOException - if the stream cannot be reset