title: Access a URL and download a wav file using javascript
body: <p>I am new to java and javascript programing. </p>
  
  <p>I was able to write a piece of code in java to access a particular URL and download the wav file from that URL (this url returns a wav file).</p>
  
  <pre><code>url = new URL('url name');
  input = url.openStream();
  output = new FileOutputStream (wavfile);
  
  byte[] buffer = new byte[500];
  int bytesRead = 0;
  while ((bytesRead = input.read(buffer, 0, buffer.length)) &gt;= 0) {
      output.write(buffer, 0, bytesRead);
  }       
  output.close();     
  </code></pre>
  
  <p>I do not want to do this in Java and want to be able to do it in Javascript. The main attempt is to use javascript and get the wav file and play it on a HTML5 enabled browser. </p>
  
  <p>I eventually want to put it on an android platform, so do not prefer to use ajax or jquery.</p>
  
  <p>Please suggest how this can be done in javascript.</p>
  
  <p>Thanks,
  axs</p>