protected int read() throws IOException {
  if (offset == buffer.length) {
    throw new ASN1Exception("Unexpected end of encoding");
  }
  if (in == null) {
    return buffer[offset++] & 0xFF;
  }
 else {
    int octet=in.read();
    if (octet == -1) {
      throw new ASN1Exception("Unexpected end of encoding");
    }
    buffer[offset++]=(byte)octet;
    return octet;
  }
}

protected int read ( ) throws IOException { if ( offset == buffer . length ) { throw new ASN1Exception ( "Unexpected end of encoding" ) ; } if ( in == null ) { return buffer [ offset ++ ] & 0xFF ; } else { int octet = in . read ( ) ; if ( octet == - 1 ) { throw new ASN1Exception ( "Unexpected end of encoding" ) ; } buffer [ offset ++ ] = ( byte ) octet ; return octet ; } }
reads the next encoded byte from the encoded input stream .
