Methods Summary |
---|
public int | available()
return remainderInBuf;
|
public void | close()
in.close();
|
public void | mark(int readLimit)
return;
|
public boolean | markSupported()
return false;
|
public int | read(byte[] b)
if (b == null)
throw (new NullPointerException("byte array is null"));
return read(b, 0, b.length);
|
public int | read(byte[] b, int off, int len)
if (EOF)
return -1;
if (b == null)
throw (new NullPointerException("byte array is null"));
if (off < 0 || len < 0 || (off+len) > b.length)
throw (new IndexOutOfBoundsException(
"offset="+off+
", len="+len+
", (off+len)="+(off+len)+
", b.length="+b.length+
", (off+len)>b.length="+
((off+len)>b.length)));
if (len == 0)
return 0;
if (remainderInBuf == 0)
readObject();
if (EOF)
return -1;
int len1 = (len > remainderInBuf) ? remainderInBuf : len;
System.arraycopy(buffer, idx, b, off, len1);
idx += len1;
remainderInBuf -= len1;
return len1;
|
public int | read()
if (EOF)
return -1;
byte ret = -1;
if (remainderInBuf == 0)
readObject();
if (EOF)
return -1;
ret = buffer[idx++];
remainderInBuf--;
return ret;
|
private void | readObject()
try {
DataInputStream dI = new DataInputStream(in);
int len = 0;
if (remainderInChannel > 0)
len = remainderInChannel;
else {
remainderInChannel = len = dI.readInt();
if (len <= 0) {
setEOF();
return;
}
}
buffer = new byte[len];
remainderInBuf = dI.read(buffer, 0, len);
if (remainderInBuf == -1) {
setEOF();
return;
}
remainderInChannel -= remainderInBuf;
idx = 0;
} catch (IOException ioe) {
if (ioe instanceof java.io.EOFException ||
ioe.getMessage().indexOf("EOF") != -1) {
setEOF();
return;
} else
throw ioe;
}
|
public void | reset()
throw (new IOException("markSupported = false"));
|
private void | setEOF()
EOF = true;
buffer = null;
remainderInBuf = 0;
idx = 0;
|
public long | skip(int n)
if (EOF)
return 0;
if (n <= 0)
return 0;
if (remainderInBuf >= n) {
idx += n;
remainderInBuf -= n;
return n;
}
int skipped = remainderInBuf;
n -= skipped;
remainderInBuf = 0;
idx = 0;
readObject();
if (EOF)
return skipped;
idx += n;
remainderInBuf -= n;
skipped += n;
return skipped;
|