KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openi > test > NullOutputStream


1 package org.openi.test;
2
3 import java.io.IOException JavaDoc;
4 import java.io.OutputStream JavaDoc;
5
6
7 /**
8  *
9  * test output stream class that does not buffer anything,
10  * but traps byte length of output stream
11  *
12  */

13 public class NullOutputStream extends OutputStream JavaDoc {
14     private long size = 0;
15
16     public NullOutputStream() {
17     }
18
19     public void write(int b) throws IOException JavaDoc {
20         //bogus
21
size++;
22     }
23
24     public long length() {
25         return this.size;
26     }
27 }
28
Popular Tags