I'm using a SequenceInputStream to read multiple files and merge them together into one file. This is way slow. I'm guessing due to buffering. How do I properly buffer with a SequenceInputStream. My code is below. Note that I'm buffering output, but not input. I tried using s.read(byte b, int off, int len) but my output was wacked, I apparantly did not use it properly.
FileOutputStream out = new FileOutputStream(strMergedFilePathAndName); BufferedOutputStream dest = new BufferedOutputStream(out, m_intBufferSize);
Thank You so much for pointing out the importance of using a Buffer. The code I used below was so very slow.
String wavFile1 = "C:\\1.mp3";
String wavFile2 = "C:\\2.mp3";
FileInputStream fistream1 = new FileInputStream(wavFile1); // first source file
FileInputStream fistream2 = new FileInputStream(wavFile2);//second source file
SequenceInputStream sistream = new SequenceInputStream(fistream1, fistream2);
FileOutputStream fostream = new FileOutputStream("D://merge1.mp3");//destinationfile
while( ( temp = sistream.read() ) != -1)
// System.out.print( (char) temp ); // to print at DOS prompt
fostream.write(temp); // to write to file