c*e
2 楼
怎么write?
我用DataInputStream in = new DataInputStream(new
FileInputStream("db-1x2.db"));
然后in.readByte()等读文件. 读到某一位置要写,怎么操作?
我用DataInputStream in = new DataInputStream(new
FileInputStream("db-1x2.db"));
然后in.readByte()等读文件. 读到某一位置要写,怎么操作?
c*t
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()等读文件. 读到某一位置要写,怎么操作?
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()等读文件. 读到某一位置要写,怎么操作?
相关阅读
performance Hit的经验请问如何设置javac和java运行时显示的语言?现在哪种java开发环境比较流行呀?浏览器显示“在入java applet失败”是什么可能?what is the best java decompiler/reverse engineering tool?要随机返回一个Set的里的元素, 如何操作呢?考一个sun certified programmer 310-035 大约需要多久?谁用过HttpUnit?请问一个定义类型的问题how to access file on local network?Eclipse 问题:as creating a dynamic web project为什么有一个java文件一向服务器上传连接就断NoClassDefFoundError关于messagedigest的问题?Exception in thread "main" java.lang.NoClassDefFoundError10201谁知道现在java认证的情形怎么样?A good website怎么样根据文件来初始化一系列实例?J2EE入门