c******e 发帖数: 139 | 1 往一个文件的指定位置写东西,比如写一个byte,该用什么method?
多谢指导! | c******e 发帖数: 139 | 2 怎么write?
我用DataInputStream in = new DataInputStream(new
FileInputStream("db-1x2.db"));
然后in.readByte()等读文件. 读到某一位置要写,怎么操作? | c*****t 发帖数: 1879 | 3 InputStream interface doesn't have the seek function. However, one
way dealing with seek is actually internally maintaining the position
counter. Then use skip() function to skip to the appropriate location.
Also, some InputStream support mark, but FileInputStream doesn't support
it.
In short, InputStream can "seek" used if your position seek is sequential.
However, if you need to seek backward, use RandomAccessFile, FileChannel,
etc.
【在 c******e 的大作中提到】 : 怎么write? : 我用DataInputStream in = new DataInputStream(new : FileInputStream("db-1x2.db")); : 然后in.readByte()等读文件. 读到某一位置要写,怎么操作?
|
|