Source Code : Byte Counting OutputStream
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Byte Counting OutputStream
import java.io.IOException;
import java.io.OutputStream;
/**
* Output stream that counts bytes written to it (but discards them).
*
* @author Jonathan Locke
*/
public final class ByteCountingOutputStream extends OutputStream
{
private long size;
/**
* @see java.io.OutputStream#write(int)
*/
public void write(int b) throws IOException
{
size++;
}
/**
* @see java.io.OutputStream#write(byte[], int, int)
*/
public void write(byte b[], int off, int len) throws IOException
{
size += len;
}
/**
* @return Number of bytes written to this stream
*/
public long size()
{
return size;
}
}
Thank with us