Exemplo n.º 1
0
  /** Reads a single character. */
  public int read() throws IOException {
    int val;

    if (closed) throw new IOException("closed");
    val = in.read();
    if (val == -1) close();
    return val;
  }
Exemplo n.º 2
0
  /** Reads the number of characters read into the buffer, or -1 on EOF. */
  public int read(char buf[], int off, int len) throws IOException {
    int val;

    if (closed) return -1; // throw new IOException ("closed");
    val = in.read(buf, off, len);
    if (val == -1) close();
    return val;
  }