Java examples for File Path IO:MappedByteBuffer
Create a read-write memory-mapped file
import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class Main { public void main(String[] argv) { try {/*from ww w . j a v a 2s . c o m*/ File file = new File("filename"); // Create a read-write memory-mapped file FileChannel rwChannel = new RandomAccessFile(file, "rw").getChannel(); ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, (int) rwChannel.size()); } catch (IOException e) { } } }