| java.lang.Object java.io.OutputStream org.apache.derby.iapi.services.io.CounterOutputStream
CounterOutputStream | public class CounterOutputStream extends OutputStream implements Limit(Code) | | An OutputStream that simply provides methods to count the number
of bytes written to an underlying stream.
|
Constructor Summary | |
public | CounterOutputStream() Create a CounterOutputStream that will discard any bytes
written but still coutn them and call its reset method
so that the count is intially zero. |
Method Summary | |
public int | clearLimit() | public int | getCount() Get count of bytes written to the stream since the last
reset() call. | public void | setLimit(int limit) Set a limit at which an exception will be thrown. | public void | setOutputStream(OutputStream out) | public void | write(int b) Add 1 to the count. | public void | write(byte b) Add b.length to the count. | public void | write(byte b, int off, int len) Add len to the count, discard the data. |
CounterOutputStream | public CounterOutputStream()(Code) | | Create a CounterOutputStream that will discard any bytes
written but still coutn them and call its reset method
so that the count is intially zero.
|
clearLimit | public int clearLimit()(Code) | | |
getCount | public int getCount()(Code) | | Get count of bytes written to the stream since the last
reset() call.
|
setLimit | public void setLimit(int limit)(Code) | | Set a limit at which an exception will be thrown. This allows callers
to count the number of bytes up to some point, without having to complete
the count. E.g. a caller may only want to see if some object will write out
over 4096 bytes, without waiting for all 200,000 bytes of the object to be written.
If the passed in limit is 0 or negative then the stream will count bytes without
throwing an exception.
See Also: EOFException |
|
|