集册 Java实例教程 创建阅读

创建阅读

欢马劈雪     最近更新时间:2020-01-02 10:19:05

344
创建一个读写存储器映射文件


import java.io.File;/*nowjava.com - 时代Java*/

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 {

      File file = new File("filename");


      // Create a read-write memory-mapped file

      FileChannel rwChannel = new RandomAccessFile(file, "rw").getChannel();//来 自 时代Java公众号 - nowjava.com

      ByteBuffer wrBuf = rwChannel.map(
展开阅读全文