Methods Summary |
---|
public void | testPooledIndividualWrites()
ByteArrayPool pool = new ByteArrayPool(32768);
writeBytesIndividually(pool);
writeBytesIndividually(pool);
writeBytesIndividually(pool);
|
public void | testPooledOneBuffer()
ByteArrayPool pool = new ByteArrayPool(32768);
writeOneBuffer(pool);
writeOneBuffer(pool);
writeOneBuffer(pool);
|
public void | testUnpooled()
ByteArrayPool pool = new ByteArrayPool(0);
writeOneBuffer(pool);
writeOneBuffer(pool);
writeOneBuffer(pool);
|
public void | testUnpooledIndividualWrites()
ByteArrayPool pool = new ByteArrayPool(0);
writeBytesIndividually(pool);
writeBytesIndividually(pool);
writeBytesIndividually(pool);
|
private void | writeBytesIndividually(ByteArrayPool pool)
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
for (int i = 0; i < data.length; i++) {
os.write(data[i]);
}
assertTrue(Arrays.equals(data, os.toByteArray()));
|
private void | writeOneBuffer(ByteArrayPool pool)
byte[] data = new byte[16384];
for (int i = 0; i < data.length; i++) {
data[i] = (byte) (i & 0xff);
}
PoolingByteArrayOutputStream os = new PoolingByteArrayOutputStream(pool);
os.write(data);
assertTrue(Arrays.equals(data, os.toByteArray()));
|