android - SequenceInputStream not merge audio file -


i want create voice recorder approx functionality completed but, need implement pause , resume functionality feature need merge 2 audio file i'm not able exact result. i've used sequence input stream merge first file code

fileinputstream fis1 = new fileinputstream(mergefile.get(0));         @suppresswarnings("resource")         fileinputstream fis2 = new fileinputstream(mergefile.get(1));          vector<fileinputstream> v = new vector<fileinputstream>();         v.add(fis1);         v.add(fis2);         enumeration<fileinputstream> e = v.elements();         string filepath = environment.getexternalstoragedirectory()                 .getpath();         file file = new file(filepath, "test");         file.mkdir();          // inputstream inputstream1 = new fileinputstream(recording1);         // inputstream inputstream2 = new fileinputstream(recording2);          @suppresswarnings("resource")         sequenceinputstream sistream = new sequenceinputstream(e);         fileoutputstream fostream = new fileoutputstream(file                 + "/myfile.mp3");          int temp = 0;         while ((temp = sistream.read()) != -1) {             // system.out.print( (char) temp ); // print @ dos prompt             fostream.write(temp); // write file         }          fostream.close();         sistream.close();         // recording1.close();         // r/ecording2.close();     } 

when play final result, plays first file.

use merger code

import java.io.*; import java.util.*; class merger { public static void main(string args[]) throws exception     {     system.out.println("enter filename");     int a,no,i,j=1;     string str,start;     int ch;     console c=system.console();     str=c.readline();     system.out.println("enter destination file size");     start=c.readline();     a=integer.parseint(start);       file fr=new file(j+str);     if(!fr.exists())     {         system.out.println("error");         system.exit(0);     }         fileoutputstream fos=new fileoutputstream((str));     for(i=0,j=1;    ;)     {         fileinputstream f=new fileinputstream(j+str);           for(i=0;   (ch=f.read())!=-1  ;++i)         fos.write(ch);         j++;             file fq=new file(j+str);         if(!(fq).exists())         {             system.out.println("process completed");             system.exit(0);         }      }     } }    

for need convert mp3 file in input stream & add input stream second 1 input stream. code text file can use audio file also.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -