Methods Summary |
---|
public int | available()
return buf.length - index;
|
protected abstract void | fill()
|
public void | mark(int readlimit)
|
public boolean | markSupported()
return false;
|
public int | read()
int result;
if (index < buf.length) {
result = buf[index];
index++;
} // end if
else {
try {
this.fill();
// fill is required to put at least one byte
// in the buffer or throw an EOF or IOException.
result = buf[0];
index = 1;
}
catch (EOFException ex) {
result = -1;
}
} // end else
return result;
|
public int | read(byte[] data, int offset, int length)
if (data == null) {
throw new NullPointerException();
}
else if ((offset < 0) || (offset > data.length) || (length < 0)
|| ((offset + length) > data.length) || ((offset + length) < 0)) {
throw new ArrayIndexOutOfBoundsException();
}
else if (length == 0) {
return 0;
}
// Check for end of stream.
int datum = this.read();
if (datum == -1) {
return -1;
}
data[offset] = (byte) datum;
int bytesRead = 1;
try {
for (; bytesRead < length ; bytesRead++) {
datum = this.read();
// In case of end of stream, return as much as we've got,
// then wait for the next call to read to return -1.
if (datum == -1) break;
data[offset + bytesRead] = (byte) datum;
}
}
catch (IOException ex) {
// Return what's already in the data array.
}
return bytesRead;
|
public void | reset()
throw new IOException("marking not supported");
|
public long | skip(long bytesToSkip)
long bytesSkipped = 0;
for (; bytesSkipped < bytesToSkip; bytesSkipped++) {
int c = this.read();
if (c == -1) break;
}
return bytesSkipped;
|