【发布时间】:2010-02-04 16:09:24
【问题描述】:
我正在编写一些数据访问测试实现,我需要随机访问文件内容。代码如下:
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rwd");
final byte b[] = IOUtils.toByteArray(source);
randomAccessFile.write(b, (int) offset, size);
其中 offset 的类型为 long。 为什么 RandomAccessFile 不提供方法:
public void write(byte b[], long off, int len)
?
如何解决这个问题?
【问题讨论】:
标签: java int long-integer random-access