CompressionHeaderBuilder(final boolean coordinateSorted) { header = new CompressionHeader(); header.externalIds = new ArrayList<>(); header.tMap = new TreeMap<>(); header.encodingMap = new TreeMap<>(); header.APDelta = coordinateSorted; }
CompressionHeaderBuilder(final boolean coordinateSorted) { header = new CompressionHeader(); header.externalIds = new ArrayList<>(); header.tMap = new TreeMap<>(); header.encodingMap = new TreeMap<>(); header.APDelta = coordinateSorted; }
/** * Read a COMPRESSION_HEADER Block from an InputStream and return its contents as a CompressionHeader * We do this instead of reading the InputStream directly because the Block content may be compressed * * @param cramVersion the CRAM version * @param blockStream the stream to read from * @return a new CompressionHeader from the input */ public static CompressionHeader read(final int cramVersion, final InputStream blockStream) { final Block block = Block.read(cramVersion, blockStream); if (block.getContentType() != BlockContentType.COMPRESSION_HEADER) throw new RuntimeIOException("Compression Header Block expected, found: " + block.getContentType().name()); try (final ByteArrayInputStream internalStream = new ByteArrayInputStream(block.getUncompressedContent())) { final CompressionHeader header = new CompressionHeader(); header.internalRead(internalStream); return header; } catch (final IOException e) { throw new RuntimeIOException(e); } }
/** * Read a COMPRESSION_HEADER Block from an InputStream and return its contents as a CompressionHeader * We do this instead of reading the InputStream directly because the Block content may be compressed * * @param cramVersion the CRAM version * @param blockStream the stream to read from * @return a new CompressionHeader from the input */ public static CompressionHeader read(final int cramVersion, final InputStream blockStream) { final Block block = Block.read(cramVersion, blockStream); if (block.getContentType() != BlockContentType.COMPRESSION_HEADER) throw new RuntimeIOException("Compression Header Block expected, found: " + block.getContentType().name()); try (final ByteArrayInputStream internalStream = new ByteArrayInputStream(block.getUncompressedContent())) { final CompressionHeader header = new CompressionHeader(); header.internalRead(internalStream); return header; } catch (final IOException e) { throw new RuntimeIOException(e); } }