setInputEncoding("UTF-8");
    private void detectEncoding()      throws IOException    {      int[] signature = new int[4];      in.mark(4);      for (int i = 0; i < 4; i++)        signature[i] = in.read();      in.reset();      // 4-byte encodings      if (equals(SIGNATURE_UCS_4_1234, signature))        setInputEncoding("UTF-32BE");      else if (equals(SIGNATURE_UCS_4_4321, signature))        setInputEncoding("UTF-32LE");      else if (equals(SIGNATURE_UCS_4_2143, signature) ||               equals(SIGNATURE_UCS_4_3412, signature))        throw new UnsupportedEncodingException("unsupported UCS-4 byte ordering");      // 2-byte encodings      else if (equals(SIGNATURE_UCS_2_12, signature))        {          setInputEncoding("UTF-16BE");          in.read();          in.read();        }      else if (equals(SIGNATURE_UCS_2_21, signature))        {          setInputEncoding("UTF-16LE");          in.read();          in.read();        }      else if (equals(SIGNATURE_UCS_2_12_NOBOM, signature))        {          setInputEncoding("UTF-16BE");          throw new UnsupportedEncodingException("no byte-order mark for UCS-2 entity");        }      else if (equals(SIGNATURE_UCS_2_21_NOBOM, signature))        {          setInputEncoding("UTF-16LE");          throw new UnsupportedEncodingException("no byte-order mark for UCS-2 entity");        }      // ASCII-derived encodings      else if (equals(SIGNATURE_UTF_8, signature))        {          // UTF-8 input encoding implied, TextDecl        }      else if (equals(SIGNATURE_UTF_8_BOM, signature))        {          setInputEncoding("UTF-8");          in.read();          in.read();          in.read();        }    }