home *** CD-ROM | disk | FTP | other *** search
- package sun.net.nntp;
-
- import java.io.FilterInputStream;
- import java.io.IOException;
- import java.io.InputStream;
-
- class NntpInputStream extends FilterInputStream {
- int column;
- boolean eofOccurred = false;
-
- public NntpInputStream(InputStream var1) {
- super(var1);
- }
-
- int eof() {
- this.eofOccurred = true;
- return -1;
- }
-
- public int read() throws IOException {
- if (this.eofOccurred) {
- return -1;
- } else {
- int var1 = super.read();
- if (var1 == 46 && this.column == 0) {
- var1 = super.read();
- if (var1 == 10) {
- return this.eof();
- }
-
- if (var1 != 46) {
- throw new NntpProtocolException("Expecting '.' - got " + var1);
- }
- }
-
- if (var1 == 10) {
- this.column = 0;
- } else {
- ++this.column;
- }
-
- return var1;
- }
- }
-
- public int read(byte[] var1) throws IOException {
- return this.read(var1, 0, var1.length);
- }
-
- public int read(byte[] var1, int var2, int var3) throws IOException {
- int var5 = var2;
-
- while(true) {
- --var3;
- if (var3 < 0) {
- break;
- }
-
- int var4 = this.read();
- if (var4 == -1) {
- break;
- }
-
- var1[var2++] = (byte)var4;
- }
-
- return var2 > var5 ? var2 - var5 : -1;
- }
-
- public void close() {
- }
- }
-