usemappedfile.java

来自「Here is the Java files with 14 different」· Java 代码 · 共 25 行

JAVA
25
字号
// $Id$import java.io.*;import java.nio.*;import java.nio.channels.*;public class UseMappedFile{  static private final int start = 0;  static private final int size = 1024;  static public void main( String args[] ) throws Exception {    RandomAccessFile raf = new RandomAccessFile( "usemappedfile.txt", "rw" );    FileChannel fc = raf.getChannel();    MappedByteBuffer mbb = fc.map( FileChannel.MapMode.READ_WRITE,      start, size );    mbb.put( 0, (byte)97 );    mbb.put( 1023, (byte)122 );    raf.close();  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?