blob: 2d174410d9338599fa5d67df53eb753360044d9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import java.io.*;
public class CountedBufferedInputStream extends BufferedInputStream
{
public int totalLen;
public CountedBufferedInputStream(InputStream in)
{
super(in);
totalLen = 0;
}
public int read() throws IOException
{
totalLen++;
return super.read();
}
public int read(byte[] buf, int a, int b) throws IOException
{
int c = super.read(buf,a,b);
if(c!=-1) totalLen = totalLen+c;
return c;
}
public int read(byte[] buf) throws IOException
{
int c = super.read(buf);
if(c!=-1) totalLen += c;
return c;
}
public int getReadTotalLen()
{ return totalLen; }
}
|