| Method from org.apache.xmlbeans.impl.common.PushedInputStream Detail: |
public synchronized int available() {
return writepos - readpos;
}
|
abstract protected void fill(int requestedBytes) throws IOException
Called when more bytes need to be written into this stream
(as an OutputStream).
This method must write at least one byte if the stream is
not ended, and it must not write any bytes if the stream has
already ended. |
public final OutputStream getOutputStream() {
return outputStream;
}
Returns the linked output stream.
This is the output stream that must be written to whenever
the fill method is called. |
public synchronized void mark(int readlimit) {
marklimit = readlimit;
markpos = readpos;
}
|
public boolean markSupported() {
return true;
}
|
public synchronized int read() throws IOException {
if (readpos >= writepos)
{
fill(1);
if (readpos >= writepos)
return -1;
}
return buf[readpos++] & 0xff;
}
|
public synchronized int read(byte[] b,
int off,
int len) throws IOException {
int avail = writepos - readpos;
if (avail < len)
{
fill(len - avail);
avail = writepos - readpos;
if (avail < = 0) return -1;
}
int cnt = (avail < len) ? avail : len;
System.arraycopy(buf, readpos, b, off, cnt);
readpos += cnt;
return cnt;
}
Read characters into a portion of an array, reading from the underlying
stream at most once if necessary. |
public synchronized void reset() throws IOException {
if (markpos < 0)
throw new IOException("Resetting to invalid mark");
readpos = markpos;
}
|
public synchronized long skip(long n) throws IOException {
if (n < = 0)
return 0;
long avail = writepos - readpos;
if (avail < n)
{
// Fill in buffer to save bytes for reset
long req = n - avail;
if (req > Integer.MAX_VALUE)
req = Integer.MAX_VALUE;
fill((int)req);
avail = writepos - readpos;
if (avail < = 0)
return 0;
}
long skipped = (avail < n) ? avail : n;
readpos += skipped;
return skipped;
}
|