Code example for EOFException

0
    int ch1 = read();
    int ch2 = read();
    int ch3 = read();
    int ch4 = read();
    if ((ch1 | ch2 | ch3 | ch4) < 0)
        throw new EOFException();
    return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)) & 0xFFFFFFFFL;
 
  } 
 
  /** 
   * Read a String from the array. 
   * @return the String value. 
   * @throws IOException 
   */ 
  public String readString() throws IOException {
    return readString(CHARSET_ENCODING);
  } 
 
  /** 
   * Read a String from the array converting using the given character set.