ByteArrayInputStream dataSegmentInput =
new ByteArrayInputStream(dataSegmentOutput.toByteArray());
Configuration conf = new Configuration();
HashMap<Text, Decompressor> decompressorCache = new HashMap<Text, Decompressor>();
for (int s = 0; s < segments; s++) {
DataSegmentReader reader = new DataSegmentReader(
new DataInputStream(dataSegmentInput), conf, decompressorCache);
newData[s] = IOUtils.toByteArray(reader.getInputStream());
}
// Compare data and newData
for (int s = 0; s < segments; s++) {
UtilsForTests.assertArrayEquals("Segment[" + s + "]", data[s].toByteArray(), newData[s]);