title: Trying to write raw PCM to WAV and only getting header
body: <p>I am currently using this code: </p>
  
  <pre><code>File wavFile=new File("tmp"+File.separator+"recordings"+File.separator+uuid.toString()+".wav");
  try{
      FileInputStream pcmInputStream=new FileInputStream(file);
      FileOutputStream wavOutputStream=new FileOutputStream(wavFile);
      AudioSystem.write(new AudioInputStream(new ByteArrayInputStream(IOUtils.toByteArray(pcmInputStream)),
      new AudioFormat(48000,16,2,true,
      true),IOUtils.toByteArray(pcmInputStream).length/4),
      AudioFileFormat.Type.WAVE,wavOutputStream);
      wavOutputStream.flush();
      wavOutputStream.close();
      pcmInputStream.close();
      fileOutputStream.close();
  }catch(IOException e){
      e.printStackTrace();
  }
  </code></pre>
  
  <p>Having checked, I can confirm that the PCM has 30 seconds of data and is approximately 4.7MB. This writes the .wav file however it is only 44 bytes and not playable, I reckon that this 44 bytes is the RIFF header but am unsure of how to solve it. I have tried using different lengths and different combinations of File/ByteArray OutputStreams.</p>