Code example for FileChannel

Methods: lock

0
			close(); 
		} 
 
        RandomAccessFile raf = new RandomAccessFile(file, "rw");
		channel = raf.getChannel();
		lock = channel.lock();
		buffer = map(channel);
	} 
 
    protected abstract MappedByteBuffer map(FileChannel channel) throws IOException;
 
    public synchronized void close() throws IOException { 
 
		if (buffer != null) {
			NioUtils.unmap(buffer);
			buffer = null;
		} 
 
        if (lock != null) {
			lock.release();
Stop searching for code, let great code find you!  Add Codota to your java IDE