Methods Summary |
---|
public synchronized long | getByteCount()The number of bytes that have passed through this stream.
NOTE: This method is an alternative for getCount() .
It was added because that method returns an integer which will
result in incorrect count for files over 2GB.
return this.count;
|
public synchronized int | getCount()The number of bytes that have passed through this stream.
NOTE: From v1.3 this method throws an ArithmeticException if the
count is greater than can be expressed by an int .
See {@link #getByteCount()} for a method using a long .
long result = getByteCount();
if (result > Integer.MAX_VALUE) {
throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int");
}
return (int) result;
|
public synchronized long | resetByteCount()Set the byte count back to 0.
NOTE: This method is an alternative for resetCount() .
It was added because that method returns an integer which will
result in incorrect count for files over 2GB.
long tmp = this.count;
this.count = 0;
return tmp;
|
public synchronized int | resetCount()Set the byte count back to 0.
NOTE: From v1.3 this method throws an ArithmeticException if the
count is greater than can be expressed by an int .
See {@link #resetByteCount()} for a method using a long .
long result = resetByteCount();
if (result > Integer.MAX_VALUE) {
throw new ArithmeticException("The byte count " + result + " is too large to be converted to an int");
}
return (int) result;
|
public void | write(byte[] b)Writes the contents of the specified byte array to this output stream
keeping count of the number of bytes written.
count += b.length;
super.write(b);
|
public void | write(byte[] b, int off, int len)Writes a portion of the specified byte array to this output stream
keeping count of the number of bytes written.
count += len;
super.write(b, off, len);
|
public void | write(int b)Writes a single byte to the output stream adding to the count of the
number of bytes written.
count++;
super.write(b);
|