如何设置输出流指向的字节?
是否可以设置 FileOutputStream 指向的字节?我的文件中有一个标头,其中留有一些空字节。一旦我写入文件,我必须返回并覆盖那些空字节。有没有办法在不打开文件两次的情况下做到这一点?
Is it possible to set the byte that a FileOutputStream
points to? I have a header in my file in which I leave some empty bytes. Once I write the file I have to go back and overwrite those empty bytes. Is there a way to do this without opening the file twice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以为此使用 java.io.RandomAccessFile。
You can use a java.io.RandomAccessFile for this.