Class BlockCompressedFilePointerUtil

java.lang.Object
htsjdk.samtools.util.BlockCompressedFilePointerUtil

public class BlockCompressedFilePointerUtil extends Object
Static for manipulating virtual file pointers in BGZF files.
  • Field Details

  • Constructor Details

    • BlockCompressedFilePointerUtil

      public BlockCompressedFilePointerUtil()
  • Method Details

    • compare

      public static int compare(long vfp1, long vfp2)
      Parameters:
      vfp1 -
      vfp2 -
      Returns:
      negative if vfp1 is earlier in file than vfp2, positive if it is later, 0 if equal.
    • areInSameOrAdjacentBlocks

      public static boolean areInSameOrAdjacentBlocks(long vfp1, long vfp2)
      Returns:
      true if vfp2 points to somewhere in the same BGZF block, or the one immediately following vfp1's BGZF block.
    • makeFilePointer

      public static long makeFilePointer(long blockAddress)
      Parameters:
      blockAddress - File offset of start of BGZF block.
      Returns:
      Virtual file pointer that points to the start of a BGZF block.
    • makeFilePointer

      public static long makeFilePointer(long blockAddress, int blockOffset)
      Parameters:
      blockAddress - File offset of start of BGZF block.
      blockOffset - Offset into uncompressed block.
      Returns:
      Virtual file pointer that embodies the input parameters.
    • getBlockAddress

      public static long getBlockAddress(long virtualFilePointer)
      Parameters:
      virtualFilePointer -
      Returns:
      File offset of start of BGZF block for this virtual file pointer.
    • getBlockOffset

      public static int getBlockOffset(long virtualFilePointer)
      Parameters:
      virtualFilePointer -
      Returns:
      Offset into uncompressed block for this virtual file pointer.
    • shift

      public static long shift(long virtualFilePointer, long offset)
      Move a virtual file pointer by a given (non-virtual) offset.
      Parameters:
      virtualFilePointer - the original virtual file pointer
      offset - the offset in bytes
      Returns:
      a new virtual file pointer shifted by the given offset
    • asString

      public static String asString(long vfp)
    • asAddressOffsetString

      public static String asAddressOffsetString(long vfp)
      Return a String with the file pointer in "address:offset" form.
      Parameters:
      vfp - virtual file pointer to format
      Returns:
      vfp formatted as string in address:offset form