title: OpenCSV can't read InputStream created by Jersey2
body: <p>I have the following code:</p>
  
  <pre><code>    @POST
      @Path("/csv")
      @Consumes(MediaType.MULTIPART_FORM_DATA)
      public String populateCSV(@FormDataParam("data") InputStream fileInputStream) throws   JsonParseException, JsonMappingException, IOException {
          ObjectMapper mapper = new ObjectMapper();
          File initialFile = new File("/Users/me/Downloads/file.csv");
          InputStream targetStream = FileUtils.openInputStream(initialFile);
          CSVReader reader = new CSVReader(new InputStreamReader(targetStream), ',', '"', 0);
          CSVReader jerseyReader = new CSVReader(new InputStreamReader(fileInputStream), ',', '"', 0);
          List&lt;String[]&gt; fileAllRows = reader.readAll();
          List&lt;String[]&gt; jerseyAllRows = jerseyReader.readAll();
          return null;
  }
  </code></pre>
  
  <p><code>jerseyAllRows</code> which is created out of <code>CSVReader</code> that reads Jersey conversion of File to InputStream returns empty lines, while <code>fileAllRows</code> which is created out of a <code>FileInputStream</code> that contains the same file that is being submitted to jersey, returns 3 lines.</p>
  
  <p>What makes the way that Jersey2 reads file create a different InputStream?</p>
  
  <p>I need to post a file to Jersey2 and be able to parse it with OpenCSV</p>
  
  <p><strong>EDITED</strong></p>
  
  <p>If I convert the jersey input stream into String like this:</p>
  
  <pre><code>InputStream is = new ByteArrayInputStream(IOUtils.toString(inputStream).getBytes());
  reader = new CSVReader(new InputStreamReader(is), ',', '"', 0);
  </code></pre>
  
  <p>I do get lines. but that's a waste of memory :( Any idea?</p>