title: How to exclude BOM with BOM InputStream
body: <p>I am trying to figure out how to simply exclude the BOM while using the example given by Apache.
  I am reading a file from <em>Internal Storage</em> and converting it first into a <code>String</code>. Then I convert it into <code>ByteArray</code> so that I get an <code>InputStream</code>.  Then I check with <code>BOMInputStream</code> for BOMs, since I had errors for "Unexpected Tokens". <strong>Now I don't know how to exclude the BOM if I have it.</strong></p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>StringBuffer fileContent = new StringBuffer("");
  String temp = "";
  int ch;
  try{
      FileInputStream fis = ctx.openFileInput("dataxml");
  try {
      while( (ch = fis.read()) != -1)
          fileContent.append((char)ch);
          temp = temp + Character.toString((char)ch);
  } catch (IOException e) {
      e.printStackTrace();
  }
  } catch (FileNotFoundException e) {
      e.printStackTrace();
  }
  
  
  InputStream ins = new ByteArrayInputStream(temp.getBytes(StandardCharsets.UTF_8));
  BOMInputStream bomIn = new BOMInputStream(ins);
  if (bomIn.hasBOM()) {
      // has a UTF-8 BOM
  
  }
  
  xpp.setInput(ins,"UTF-8");
  parseXMLAndStoreIt(xpp);
  ins.close();
  </code></pre>
  
  <p>The filename is "dataxml", which I store in different Class with <code>openFileOutput</code>.</p>