title: How do you fix a Resetting to invalid mark error for a BufferedInputStream?
body: <p>I have read similar pages on why this happens, but not one of them has actually explained how you can fix this problem.</p>
  
  <p>My program is converting a byte array to a .wav file and there are about 2 million values in the byte array.</p>
  
  <pre><code>String uploadedFileLocation = "C:\\";
  AudioInputStream source;
  AudioInputStream pcm;
  InputStream b_in = new ByteArrayInputStream(byteArray);
  source = AudioSystem.getAudioInputStream(new BufferedInputStream(b_in));
  pcm = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, source);
  File newFile = new File(uploadedFileLocation + fileName);
  AudioSystem.write(pcm, AudioFileFormat.Type.WAVE, newFile);
  source.close();
  pcm.close();
  </code></pre>