* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class TruncatingOutputStreamTest extends TestCase {
public void testTOS() throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TruncatingOutputStream tos = new TruncatingOutputStream(bos, 2, 8);
tos.write(new byte[] {55, 0, 1, 2, 3, 4, 55, 55, 55}, 1, 5);
tos.write(new byte[] {55, 5, 6, 7, 8, 9, 10, 11}, 1, 7);
byte[] ba = bos.toByteArray();
byte[] correct = new byte[] {2, 3, 4, 5, 6, 7, 8, 9};
boolean same = ba.length == correct.length;
for (int x=0; x<ba.length; x++) {
System.out.print(" "+ba[x]+":"+correct[x]);