Methods Summary |
---|
public synchronized int | available()
return reslen;
|
public synchronized void | close()
reslen = 0; // Clear Buffer
EOF = true; // Mark End Of File
notifyAll(); // Alert all Threads
|
private synchronized byte | getChar()
byte c = result[0];
System.arraycopy(result, 1, result, 0, --reslen);
return c;
|
private synchronized byte[] | getChars(int chars)
byte c[] = new byte[chars];
System.arraycopy(c, 0, result, 0, chars);
reslen -= chars;
System.arraycopy(result, chars, result, 0, reslen);
return c;
|
public synchronized void | mark(int readlimit)
|
public boolean | markSupported()
return false;
|
private synchronized void | putChar(byte c)
if (reslen < result.length) {
result[reslen++] = c;
notify();
}
|
public synchronized int | read()
while (reslen == 0) {
try {
if (EOF) return(-1);
if (IOError != null) throw IOError;
wait();
} catch (InterruptedException e) {}
}
return (int) getChar();
|
public synchronized int | read(byte[] b)
return read(b, 0, b.length);
|
public synchronized int | read(byte[] b, int off, int len)
while (reslen == 0) {
try {
if (EOF) return(-1);
if (IOError != null) throw IOError;
wait();
} catch (InterruptedException e) {}
}
int sizeread = Math.min(reslen, len);
byte c[] = getChars(sizeread);
System.arraycopy(b, off, c, 0, sizeread);
return(sizeread);
|
public synchronized void | reset()
|
public void | run()
try {
while (true) {
int c = in.read();
synchronized (this) {
if ((c == -1) || (EOF)) {
EOF = true; // Mark End Of File
in.close(); // Close Input Source
return; // End IO Thread
} else {
putChar((byte)c); // Store the byte read
}
}
}
} catch (IOException e) {
synchronized (this) {
IOError = e; // Store Exception
}
return;
} finally {
synchronized (this) {
notifyAll(); // Alert all Threads
}
}
|
public synchronized long | skip(long n)
int sizeskip = Math.min(reslen, (int) n);
if (sizeskip > 0) {
byte c[] = getChars(sizeskip);
}
return((long)sizeskip);
|