title: Audio File Encoding and Decoding
body: <p>What is the efficient way to encode and decode an audio file in android
  I have tried the Base64 as below but after decoding the file size get increased. 
  <strong>Encode</strong></p>
  
  <pre><code> ByteArrayOutputStream objByteArrayOS = new ByteArrayOutputStream();
          File file = new File(path);
          FileInputStream objFileIS;
          try {
              objFileIS = new FileInputStream(file);
              byte[] byteBufferString = new byte[1024];
  
          for (int readNum; (readNum = objFileIS.read(byteBufferString)) != -1;) {
              objByteArrayOS.write(byteBufferString, 0, readNum);
              System.out.println("read " + readNum + " bytes,");
              byte[] bytes = FileUtils.readFileToByteArray(file);
  
  
              strAttachmentCoded = Base64.encodeToString(bytes,
                      Base64.DEFAULT);
  </code></pre>
  
  <p><strong>Decode</strong></p>
  
  <pre><code>byte[] decoded = Base64.decode(strAttachmentCoded,
                      Base64.DEFAULT);
              // byte[] decoded1 = Base64.decode(byteBinaryData1, 0);
              File file1 = new File(pathAudio);
  
              FileOutputStream os = new FileOutputStream(file1, true);
              os.write(decoded);
  
              os.close();
  </code></pre>
  
  <p>i want audio in String format to send to server and retrieve the same as per the user requirement.</p>