- /**
- * 需求:将两个amr格式音频文件合并为1个
- * 注意:amr格式的头文件为6个字节的长度
- * @param partsPaths 各部分路径
- * @param unitedFilePath 合并后路径
- */
- public void uniteAMRFile(String[] partsPaths, String unitedFilePath) {
- try {
- File unitedFile = new File(unitedFilePath);
- FileOutputStream fos = new FileOutputStream(unitedFile);
- RandomAccessFile ra = null;
- for (int i = 0; i < partsPaths.length; i++) {
- ra = new RandomAccessFile(partsPaths[i], "r");
- if (i != 0) {
- ra.seek(6);
- }
- byte[] buffer = new byte[1024 * 8];
- int len = 0;
- while ((len = ra.read(buffer)) != -1) {
- fos.write(buffer, 0, len);
- }
- }
- ra.close();
- fos.close();
- } catch (Exception e) {
- }
- }
-
-
from: http://blog.csdn.net/lfdfhl/article/details/8542078
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)