TestStreamBasicspublic class TestStreamBasics extends StreamTest
Fields Summary |
---|
public static final byte[] | compressedStreamDCHeaderThe header from when compressedStream is decompressed | public static final byte[] | compressedStream | public static final byte[] | uncompressedStream |
Methods Summary |
---|
public void | testCompressedStream()
// Create a fake pointer
Pointer ptr = new TestPointer(true, 0, compressedStream.length, -1, (short)-1);
// Now the stream
Stream stream = Stream.createStream(ptr, compressedStream, null, null);
// Check
assertNotNull(stream.getPointer());
assertNotNull(stream.getStore());
assertTrue(stream.getStore() instanceof StreamStore);
assertTrue(stream.getStore() instanceof CompressedStreamStore);
assertTrue(stream instanceof UnknownStream);
// Check the stream store
CompressedStreamStore ss = (CompressedStreamStore)stream.getStore();
assertEquals(4, ss._getBlockHeader().length);
assertEquals(compressedStream.length, ss._getCompressedContents().length);
assertEquals(uncompressedStream.length, ss.getContents().length);
for(int i=0; i<uncompressedStream.length; i++) {
assertEquals(uncompressedStream[i], ss.getContents()[i]);
}
| public void | testUncompressedStream()
// Create a fake pointer
Pointer ptr = new TestPointer(false, 0, uncompressedStream.length, -1, (short)-1);
// Now the stream
Stream stream = Stream.createStream(ptr, uncompressedStream, null, null);
// Check
assertNotNull(stream.getPointer());
assertNotNull(stream.getStore());
assertTrue(stream.getStore() instanceof StreamStore);
assertFalse(stream.getStore() instanceof CompressedStreamStore);
assertTrue(stream instanceof UnknownStream);
|
|