private int readByte() {
   if (lenbuf == -1) throw new InputMismatchException();
   if (ptrbuf >= lenbuf) {
     ptrbuf = 0;
     try {
       lenbuf = in.read(inbuf);
     } catch (IOException e) {
       throw new InputMismatchException();
     }
     if (lenbuf <= 0) return -1;
   }
   return inbuf[ptrbuf++];
 }
Exemple #2
0
 public int read() {
   if (numChars == -1) throw new InputMismatchException();
   if (curChar >= numChars) {
     curChar = 0;
     try {
       numChars = stream.read(buf);
     } catch (IOException e) {
       throw new InputMismatchException();
     }
     if (numChars <= 0) return -1;
   }
   return buf[curChar++];
 }