在十六进制bytearray中读取文件,然后将该数组的一部分写入另一个文件-Java Android
我有一个200kb文件,必须在字节中读取它,然后将此字节的一部分(从索引90000到165000)写入另一个文件。我该怎么做。
File file1 = new File(getExternalStorageDirectory(), "file1.raw"); //the 200kb file
try {
File.createTempFile("file2", "mp3", getCacheDir()); //empty file that needs to get filled with part of the byte array from file1
} catch (IOException ignored) {}
I have a 200kb file and I have to read it in bytes, and then write part of this byteArray (from index 90000 to 165000) to another file. How can I accomplish this.
File file1 = new File(getExternalStorageDirectory(), "file1.raw"); //the 200kb file
try {
File.createTempFile("file2", "mp3", getCacheDir()); //empty file that needs to get filled with part of the byte array from file1
} catch (IOException ignored) {}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
RandomAccessfile
,以寻求偏移以开始复制。例如:
Use a
RandomAccessFile
in order to seek to the offset to start copying from.For example: