Package htsjdk.samtools.util
Class BlockCompressedFilePointerUtil
- java.lang.Object
-
- htsjdk.samtools.util.BlockCompressedFilePointerUtil
-
public class BlockCompressedFilePointerUtil extends Object
Static for manipulating virtual file pointers in BGZF files.
-
-
Field Summary
Fields Modifier and Type Field Description static long
MAX_BLOCK_ADDRESS
static int
MAX_OFFSET
-
Constructor Summary
Constructors Constructor Description BlockCompressedFilePointerUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
areInSameOrAdjacentBlocks(long vfp1, long vfp2)
static String
asAddressOffsetString(long vfp)
Return a String with the file pointer in "address:offset" form.static String
asString(long vfp)
static int
compare(long vfp1, long vfp2)
static long
getBlockAddress(long virtualFilePointer)
static int
getBlockOffset(long virtualFilePointer)
static long
makeFilePointer(long blockAddress)
static long
makeFilePointer(long blockAddress, int blockOffset)
static long
shift(long virtualFilePointer, long offset)
Move a virtual file pointer by a given (non-virtual) offset.
-
-
-
Field Detail
-
MAX_BLOCK_ADDRESS
public static final long MAX_BLOCK_ADDRESS
- See Also:
- Constant Field Values
-
MAX_OFFSET
public static final int MAX_OFFSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
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
-
-