home *** CD-ROM | disk | FTP | other *** search
/ Online Today 2000 January / Onto0100.iso / pc / JAVA / MSJAVX86.EXE / xmldso.cab / XML4IE3.cab / com / ms / xml / parser / EntityReader.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-10-10  |  1.4 KB  |  59 lines

  1. package com.ms.xml.parser;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5.  
  6. class EntityReader {
  7.    int line;
  8.    int column;
  9.    EntityReader prev;
  10.    Object owner;
  11.    int[] next = new int[2];
  12.    int pos;
  13.    InputStream input;
  14.  
  15.    public int read() throws ParseException {
  16.       int var1;
  17.       if (this.pos >= 0) {
  18.          int[] var10000 = this.next;
  19.          int var10003 = this.pos;
  20.          this.pos = var10003 + -1;
  21.          var1 = var10000[var10003];
  22.       } else {
  23.          try {
  24.             var1 = this.input.read();
  25.          } catch (IOException var5) {
  26.             String var3 = this.owner.toString();
  27.             var1 = -1;
  28.             throw new ParseException("Error reading " + var3 + " at (" + this.line + "," + this.column + ") : " + var5, this.line, this.column, this.owner);
  29.          }
  30.       }
  31.  
  32.       if (var1 == 10) {
  33.          ++this.line;
  34.          this.column = 1;
  35.       } else {
  36.          ++this.column;
  37.       }
  38.  
  39.       return var1;
  40.    }
  41.  
  42.    void push(char var1) throws ParseException {
  43.       if (this.pos == 1) {
  44.          throw new ParseException("Error unreading '" + var1 + "' at (" + this.line + "," + this.column + ") : ", this.line, this.column, this.owner);
  45.       } else {
  46.          this.next[++this.pos] = var1;
  47.       }
  48.    }
  49.  
  50.    EntityReader(InputStream var1, int var2, int var3, EntityReader var4, Object var5) {
  51.       this.line = var2;
  52.       this.column = var3;
  53.       this.prev = var4;
  54.       this.owner = var5;
  55.       this.pos = -1;
  56.       this.input = var1;
  57.    }
  58. }
  59.