@Test
public void testStreams() throws IOException
{
ByteArrayOutputStream byteArrayOStream1 = new ByteArrayOutputStream();
EncodedDataOutputStream odos = new EncodedDataOutputStream(byteArrayOStream1);
ByteArrayOutputStream byteArrayOStream2 = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(byteArrayOStream2);
for (short i = 0; i < 10000; i++)
{
out.writeShort(i);
odos.writeShort(i);
}
out.flush();
odos.flush();
for (int i = Short.MAX_VALUE; i < ((int)Short.MAX_VALUE + 10000); i++)
{
out.writeInt(i);
odos.writeInt(i);
}
out.flush();
odos.flush();
for (long i = Integer.MAX_VALUE; i < ((long)Integer.MAX_VALUE + 10000);i++)
{
out.writeLong(i);
odos.writeLong(i);
}
out.flush();
odos.flush();
Assert.assertTrue(byteArrayOStream1.size() < byteArrayOStream2.size());
ByteArrayInputStream byteArrayIStream1 = new ByteArrayInputStream(byteArrayOStream1.toByteArray());
EncodedDataInputStream idis = new EncodedDataInputStream(new DataInputStream(byteArrayIStream1));