Source:
<code>public Container buildContainer(final List<CramCompressionRecord> records, final byte[] refBases, final long offset) { final boolean coordinateSorted = samFileHeader.getSortOrder() == SAMFileHeader.SortOrder.coordinate; final CompressionHeader header = new CompressionHeaderFactory().build(records, null, coordinateSorted); header.readNamesIncluded = preserveReadNames; final Container container = new Container(); container.header = header; container.nofRecords = records.size(); container.globalRecordCounter = globalRecordCounter; container.bases = 0; container.blockCount = 0; container.offset = offset; final List<IndexableSlice> slices = new ArrayList<>(); try (final ByteArrayOutputStream osForIndexMetadata = new ByteArrayOutputStream()) { <START> final Version version = CramVersions.CRAM_v3; <END> container.header.write(version, osForIndexMetadata); long globalRecordCounterCopy = container.globalRecordCounter; int sliceIndex = 0; for (int i = 0; i < records.size(); i += recordsPerSlice) { final List<CramCompressionRecord> sliceRecords = records.subList(i, Math.min(records.size(), i + recordsPerSlice)); final Slice slice = buildSlice(sliceRecords, header, globalRecordCounterCopy, refBases); globalRecordCounterCopy += sliceRecords.size(); final int sliceByteOffset = osForIndexMetadata.size(); slice.write(version.major, osForIndexMetadata); final int sliceByteSize = osForIndexMetadata.size() - sliceByteOffset; slices.add(slice.withIndexingMetadata(sliceByteOffset, sliceByteSize, sliceIndex++)); container.bases += sliceRecords.stream().map(r -> r.readLength).reduce(Integer::sum).orElse(0); if (container.sequenceId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && !slice.hasNoReference()) container.sequenceId = slice.getSequenceId(); } } catch (final IOException e) { throw new RuntimeIOException(e); } container.slices = slices.toArray(new IndexableSlice[0]); calculateAlignmentBoundaries(container); globalRecordCounter += records.size(); return container; }</code><technical_language>This CramVersions.DEFAULT_CRAM_VERSION</technical_language>

Target:
public Container buildContainer(final List<CramCompressionRecord> records, final byte[] refBases, final long offset) { final boolean coordinateSorted = samFileHeader.getSortOrder() == SAMFileHeader.SortOrder.coordinate; final CompressionHeader header = new CompressionHeaderFactory().build(records, null, coordinateSorted); header.readNamesIncluded = preserveReadNames; final Container container = new Container(); container.header = header; container.nofRecords = records.size(); container.globalRecordCounter = globalRecordCounter; container.bases = 0; container.blockCount = 0; container.offset = offset; final List<IndexableSlice> slices = new ArrayList<>(); try (final ByteArrayOutputStream osForIndexMetadata = new ByteArrayOutputStream()) { final Version version = CramVersions.DEFAULT_CRAM_VERSION; container.header.write(version, osForIndexMetadata); long globalRecordCounterCopy = container.globalRecordCounter; int sliceIndex = 0; for (int i = 0; i < records.size(); i += recordsPerSlice) { final List<CramCompressionRecord> sliceRecords = records.subList(i, Math.min(records.size(), i + recordsPerSlice)); final Slice slice = buildSlice(sliceRecords, header, globalRecordCounterCopy, refBases); globalRecordCounterCopy += sliceRecords.size(); final int sliceByteOffset = osForIndexMetadata.size(); slice.write(version.major, osForIndexMetadata); final int sliceByteSize = osForIndexMetadata.size() - sliceByteOffset; slices.add(slice.withIndexingMetadata(sliceByteOffset, sliceByteSize, sliceIndex++)); container.bases += sliceRecords.stream().map(r -> r.readLength).reduce(Integer::sum).orElse(0); if (container.sequenceId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX && !slice.hasNoReference()) container.sequenceId = slice.getSequenceId(); } } catch (final IOException e) { throw new RuntimeIOException(e); } container.slices = slices.toArray(new IndexableSlice[0]); calculateAlignmentBoundaries(container); globalRecordCounter += records.size(); return container; }