Package htsjdk.samtools.util
Class BlockCompressedFilePointerUtil
java.lang.Object
htsjdk.samtools.util.BlockCompressedFilePointerUtil
Static for manipulating virtual file pointers in BGZF files.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareInSameOrAdjacentBlocks(long vfp1, long vfp2) static StringasAddressOffsetString(long vfp) Return a String with the file pointer in "address:offset" form.static StringasString(long vfp) static intcompare(long vfp1, long vfp2) static longgetBlockAddress(long virtualFilePointer) static intgetBlockOffset(long virtualFilePointer) static longmakeFilePointer(long blockAddress) static longmakeFilePointer(long blockAddress, int blockOffset) static longshift(long virtualFilePointer, long offset) Move a virtual file pointer by a given (non-virtual) offset.
-
Field Details
-
MAX_BLOCK_ADDRESS
public static final long MAX_BLOCK_ADDRESS- See Also:
-
MAX_OFFSET
public static final int MAX_OFFSET- See Also:
-
-
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 pointeroffset- the offset in bytes- Returns:
- a new virtual file pointer shifted by the given offset
-
asString
-
asAddressOffsetString
Return a String with the file pointer in "address:offset" form.- Parameters:
vfp- virtual file pointer to format- Returns:
vfpformatted as string in address:offset form
-