Stripping HTTP Header Information from a FileInputStream or FileReader
<p>I'm pretty new to Java. I'm passing in a file from a Web page form to Java via JaxRS. I then read the file with a FileInputStream (I've also tried a FileReader, I'm not sure which I ought to use) and then shuttle that data in to a StringBuffer to be converted in to a string with StringBuffer.toString().</p>

<p>What I've noticed is that I'm getting the HTTP header information in my String. Stuff like Content-Disposition, filename, and Content-Type. Is there a convenient way to strip out that information prior to calling StringBuffer.toString()?</p>

<p>Here's a sample of my code with the irrelevant bits stripped out:</p>

<pre><code>public Response method(@FormDataParam("fileToUpload") File file)
{
  StringBuffer strBuffer=new StringBuffer("");
  String fileAsString;

  try
  {
      FileInputStream fileInputStream=new FileInputStream(file);

      int characterIndex;
      while ((characterIndex = fileInputStream.read()) != -1)
      {
          strBuffer.append((char)characterIndex);
      }

      fileInputStream.close();

      fileAsString=strBuffer.toString(); //I'd like to have the HTTP header info stripped before getting to this point without having to do some sort of manual string manipulation.
  }
  catch (FileNotFoundException e){}
  catch (IOException e){}
}
</code></pre>

<p>Thanks so much for your help!</p>
