Package htsjdk.samtools.cram.structure
Class ContainerIO
- java.lang.Object
-
- htsjdk.samtools.cram.structure.ContainerIO
-
public class ContainerIO extends Object
Methods to read and write CRAM containers.
-
-
Constructor Summary
Constructors Constructor Description ContainerIO()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Container
readContainer(Version version, InputStream inputStream)
Reads a CRAM container from the input stream.static Container
readContainerHeader(int major, InputStream inputStream)
Reads container header only from aInputStream
.static int
writeContainer(Version version, Container container, OutputStream outputStream)
Writes a completeContainer
with it's header to aOutputStream
.static int
writeContainerHeader(int major, Container container, OutputStream outputStream)
Writes aContainer
header information to aOutputStream
.
-
-
-
Method Detail
-
readContainer
public static Container readContainer(Version version, InputStream inputStream) throws IOException
Reads a CRAM container from the input stream. Returns an EOF container when there is no more data or the EOF marker found.- Parameters:
version
- CRAM version to expectinputStream
- the stream to read from- Returns:
- a new container object read from the stream
- Throws:
IOException
- as per java IO contract
-
readContainerHeader
public static Container readContainerHeader(int major, InputStream inputStream) throws IOException
Reads container header only from aInputStream
.- Parameters:
major
- the CRAM version to assumeinputStream
- the input stream to read from- Returns:
- a new
Container
object with container header values filled out but empty body (no slices and blocks). - Throws:
IOException
- as per java IO contract
-
writeContainerHeader
public static int writeContainerHeader(int major, Container container, OutputStream outputStream) throws IOException
Writes aContainer
header information to aOutputStream
.- Parameters:
major
- the CRAM version to assumecontainer
- the container holding the header to writeoutputStream
- the stream to write to- Returns:
- the number of bytes written
- Throws:
IOException
- as per java IO contract
-
writeContainer
public static int writeContainer(Version version, Container container, OutputStream outputStream) throws IOException
Writes a completeContainer
with it's header to aOutputStream
. The method is aware of file header containers and is suitable for general purpose use: basically any container is allowed.- Parameters:
version
- the CRAM version to assumecontainer
- the container to writeoutputStream
- the stream to write to- Returns:
- the number of bytes written out
- Throws:
IOException
- as per java IO contract
-
-