title: Reading Strings and Binary from the same FileInputStream
body: <p>I have a file that contains some amount of plain text at the start followed by binary content at the end. The size of the binary content is determined by some one of the plain text lines I read.</p>
  
  <p>I was using a <code>BufferedReader</code> to read the individual lines, however it exposes no methods to refer to read a byte array. The <code>readUTF</code> for a <code>DataInputStream</code> doesnt read all the way to the end of the line, and the <code>readLine</code> method is deprecated.</p>
  
  <p>Using the underlying <code>FileInputStream</code> to read returns empty byte arrays. Any suggestions on how to go about this?</p>
  
  <hr>
  
  <pre><code>private DOTDataInfo parseFile(InputStream stream) throws IOException{
  DOTDataInfo info = new DOTDataInfo();
  BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
  int binSize = 0;
  String line;
  while((line = reader.readLine()) != null){
      if(line.length() == 0)
          break;
      DOTProperty prop = parseProperty(line);
      info.getProperties().add(prop);
      if(prop.getName().equals("ContentSize"))
          binSize = Integer.parseInt(prop.getValue());
  }
  byte[] content = new byte[binSize];
  stream.read(content); //Its all empty now. If I use a DataInputStream instead, its got the values from the file
  return info;
  }
  </code></pre>