
{filelink=7620}
import java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.io.IOException;
public class Fichiers
{
public static void main(String[] arg) throws IOException
{
File fichier = new File("test.txt");
// Créer le fichier en mode lecture
FileChannel write_lock = new RandomAccessFile(fichier, "r").getChannel();
ByteBuffer readonlybuffer = write_lock.map(FileChannel.MapMode.READ_ONLY, 0, (int) write_lock
.size());
}
}