Package htsjdk.samtools.cram.build
Class CramIO
- java.lang.Object
-
- htsjdk.samtools.cram.build.CramIO
-
public final class CramIO extends Object
A collection of methods to read and write special values to/from CRAM files.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCRAM_FILE_EXTENSIONDeprecated.since June 2019 UseFileExtensions.CRAMinstead.static intEOF_ALIGNMENT_SPANstatic intEOF_ALIGNMENT_STARTstatic intEOF_BLOCK_SIZE_V2static intEOF_BLOCK_SIZE_V3static byte[]ZERO_B_EOF_MARKERThe 'zero-B' EOF marker as per CRAM specs v2.1.static byte[]ZERO_F_EOF_MARKERThe zero-F EOF marker as per CRAM specs v3.0.
-
Constructor Summary
Constructors Constructor Description CramIO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CramHeaderreadCramHeader(InputStream inputStream)Read CRAM header from the givenInputStream.static byte[]samHeaderToByteArray(SAMFileHeader samFileHeader)static longwriteCramEOF(CRAMVersion cramVersion, OutputStream outputStream)Write an end-of-file marker to theOutputStream.static longwriteCramHeader(CramHeader cramHeader, OutputStream outputStream)Writes CRAM header into the specifiedOutputStream.
-
-
-
Field Detail
-
CRAM_FILE_EXTENSION
@Deprecated public static final String CRAM_FILE_EXTENSION
Deprecated.since June 2019 UseFileExtensions.CRAMinstead.- See Also:
- Constant Field Values
-
ZERO_B_EOF_MARKER
public static final byte[] ZERO_B_EOF_MARKER
The 'zero-B' EOF marker as per CRAM specs v2.1. This is basically a serialized empty CRAM container with sequence id set to some number to spell out 'EOF' in hex.
-
ZERO_F_EOF_MARKER
public static final byte[] ZERO_F_EOF_MARKER
The zero-F EOF marker as per CRAM specs v3.0. This is basically a serialized empty CRAM container with sequence id set to some number to spell out 'EOF' in hex.
-
EOF_ALIGNMENT_START
public static final int EOF_ALIGNMENT_START
- See Also:
- Constant Field Values
-
EOF_BLOCK_SIZE_V3
public static final int EOF_BLOCK_SIZE_V3
- See Also:
- Constant Field Values
-
EOF_BLOCK_SIZE_V2
public static final int EOF_BLOCK_SIZE_V2
- See Also:
- Constant Field Values
-
EOF_ALIGNMENT_SPAN
public static final int EOF_ALIGNMENT_SPAN
- See Also:
- Constant Field Values
-
-
Method Detail
-
writeCramEOF
public static long writeCramEOF(CRAMVersion cramVersion, OutputStream outputStream)
Write an end-of-file marker to theOutputStream. The specific EOF marker is chosen based on the CRAM version. On read, this is interpreted as a special container sentinel indicating no more containers. The treatment of these EOF markers is asymmetric in that on read, the EOF marker is read in as a special container with sentinel values indicating it is an EOF container (as defined by the spec).- Parameters:
cramVersion- the CRAM version to assumeoutputStream- the stream to write to- Returns:
- the number of bytes written out
-
writeCramHeader
public static long writeCramHeader(CramHeader cramHeader, OutputStream outputStream)
Writes CRAM header into the specifiedOutputStream.- Parameters:
cramHeader- theCramHeaderobject to writeoutputStream- the output stream to write to- Returns:
- the number of bytes written out
-
readCramHeader
public static CramHeader readCramHeader(InputStream inputStream)
Read CRAM header from the givenInputStream.- Parameters:
inputStream- input stream to read from- Returns:
- complete
CramHeaderobject
-
samHeaderToByteArray
public static byte[] samHeaderToByteArray(SAMFileHeader samFileHeader)
-
-