1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
public Uri buildPrompt(final Uri fileUri)
{
try {
final InputStream prompt =
VVMApplication.getContext().getResources().openRawResource(R.raw.operator_vs_prompt1);
final InputStream prompt3 =
VVMApplication.getContext().getResources().openRawResource(R.raw.operator_vs_prompt2);
FileOutputStream fos = new FileOutputStream(PROMPT_TEMP_FILE, false);
final File file = new File(fileUri.getPath());
InputStream fis = new FileInputStream(file);
concatenateStreams(fos,prompt3);
fos.close();
fis.close();
return Uri.fromFile(Mon Fichier);
} catch (final Exception e) {
return fileUri;
}
public static int concatenateStreams( FileOutputStream out, InputStream ... ins)
{
int total = 0;
byte[] buffer = new byte[BUFFER_SIZE];
try {
for (InputStream in : ins) {
int avail;
while ((avail = in.read(buffer)) > 0) {
out.write(buffer,0,avail);
total += avail;
}
}
} catch (Exception e){
}
return total;
} |
Partager