[例] 用MappedByteBuffer更新文件内容
来源:互联网 发布:刷话费软件 编辑:程序博客网 时间:2024/06/05 18:58
import java.io.IOException;import java.io.RandomAccessFile;import java.nio.MappedByteBuffer;import java.nio.channels.FileChannel;public class Test_00 {public static void main(String[] args) throws IOException {test1();}public static void test1() throws IOException {RandomAccessFile fis = new RandomAccessFile("C:\\test\\test3.ini", "rw");FileChannel fci = fis.getChannel();MappedByteBuffer mbb = fci.map(FileChannel.MapMode.READ_WRITE, 0,fis.length());System.out.println(mbb.position());byte dst[] = new byte[(int) fis.length()];mbb.get(dst);System.out.println(mbb.position());System.out.println(new String(dst));dst[0] = 'X';dst[1] = 'Y';dst[2] = 'Z';mbb.position(0);mbb.put(dst);fis.close();}}
0 0
- [例] 用MappedByteBuffer更新文件内容
- MappedByteBuffer+RandomAccessFile读写文件
- java、mappedByteBuffer读取文件
- 内存映射文件:MappedByteBuffer
- 更新指定文件内容
- MappedByteBuffer
- MappedByteBuffer
- RandomAccessFile、FileChannel、MappedByteBuffer读写文件
- java nio MappedByteBuffer 文件映射
- RandomAccessFile && MappedByteBuffer读取大文件
- 更新App.config文件内容
- RandomAcessFile、MappedByteBuffer和缓冲读/写文件
- RandomAcessFile、MappedByteBuffer和缓冲读/写文件
- RandomAcessFile、MappedByteBuffer和缓冲读/写文件
- Java读取文件 利用MappedByteBuffer进行缓冲
- RandomAcessFile、MappedByteBuffer和缓冲读/写文件
- MappedByteBuffer高速缓存文件、RandomAccessFile随机访问
- 高效的文件拷贝之MappedByteBuffer
- 黑马程序员-第二十二天( IO包中其它流对象)
- Asterisk中利用ConfBridge实现三方通话
- 一个由两个长的如此相像的字引起的问题
- ExtJS处理2种情况下的数据编辑
- Binary Tree Preorder Traversal
- [例] 用MappedByteBuffer更新文件内容
- 寻找最大数
- HLG 2061
- [poj2739][水题]数论_求素数和
- 黑马程序员-第二十三天(字符编码)
- oracle笔记
- HDU 2015 偶数求和
- 使用 Video4Linux 采集USB摄像头的图像,并保存到一张 jpg图像文件中的程序
- Cocos2D-x游戏开发之九:屏幕触摸一:基本屏幕操作响应