System.out.println(container.h);
SliceIO sio = new SliceIO();
container.slices = new Slice[container.landmarks.length];
for (int s = 0; s < container.landmarks.length; s++) {
Slice slice = new Slice();
sio.read(slice, stream);
container.slices[s] = slice;
}
System.out.println(container);
ArrayList<CramRecord> records = new ArrayList<CramRecord>(
container.nofRecords);
BLOCK_PROTO.getRecords(container.h, container,
cramHeader.samFileHeader, records);
testALignmentSpan(container, cramHeader, records);
for (int i = 0; i < records.size(); i++) {
if (i < 10)
System.out.println(records.get(i).toString());
}
ExposedByteArrayOutputStream baos = new ExposedByteArrayOutputStream(
BYTES);
ReadWrite.writeCramHeader(cramHeader, baos);
byte[] b = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(b);
CramHeader cramHeader2 = ReadWrite.readCramHeader(bais);
assertEquals(toString(cramHeader.samFileHeader),
toString(cramHeader2.samFileHeader));
BLOCK_PROTO.recordsPerSlice = container.slices[0].nofRecords;
Container container2 = BLOCK_PROTO.buildContainer(records,
cramHeader.samFileHeader, true, 0, container.h.substitutionMatrix, true);
for (int i = 0; i < container.slices.length; i++) {
container2.slices[i].refMD5 = container.slices[i].refMD5;
}
ReadWrite.writeContainer(container2, baos);
bais = new ByteArrayInputStream(baos.toByteArray());
cramHeader2 = ReadWrite.readCramHeader(bais);
assertNotNull(cramHeader);
assertNotNull(cramHeader.samFileHeader);
assertEquals(2, cramHeader.majorVersion);
assertEquals(0, cramHeader.minorVersion);
Container container3 = new Container();
chio.readContainerHeader(container3, bais);
assertNotNull(container3);
System.out.println(container3);
CompressionHeaderBLock chb3 = new CompressionHeaderBLock(bais);
container3.h = chb3.getCompressionHeader();
assertNotNull(container3.h);
System.out.println(container3.h);
container3.slices = new Slice[container3.landmarks.length];
for (int s = 0; s < container3.landmarks.length; s++) {
Slice slice = new Slice();
sio.readSliceHeadBlock(slice, bais);
sio.readSliceBlocks(slice, true, bais);
container3.slices[s] = slice;
}