avatar
问个io的问题# Java - 爪哇娇娃
c*e
1
往一个文件的指定位置写东西,比如写一个byte,该用什么method?
多谢指导!
avatar
c*e
2
怎么write?
我用DataInputStream in = new DataInputStream(new
FileInputStream("db-1x2.db"));
然后in.readByte()等读文件. 读到某一位置要写,怎么操作?
avatar
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()等读文件. 读到某一位置要写,怎么操作?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。