Java Convert via ByteBuffer toMappedBuffer(File file, long start, long end)

Here you can find the source of toMappedBuffer(File file, long start, long end)

Description

to Mapped Buffer

License

Open Source License

Declaration

public static ByteBuffer toMappedBuffer(File file, long start, long end) throws IOException 

Method Source Code


//package com.java2s;
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 static ByteBuffer toMappedBuffer(File file, long start, long end) throws IOException {
        try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
            return raf.getChannel().map(FileChannel.MapMode.READ_ONLY, start, end);
        }//from   w  w w .  j av  a2s .c  o  m
    }
}

Related

  1. toLongArray(byte[] b)
  2. ToLongArray(byte[] data)
  3. toLongArray(byte[] ids)
  4. toMappedBuffer(File file)
  5. toMappedBuffer(File file)
  6. toMsftBinary(UUID uuid)
  7. toShort(byte firstByte, byte secondByte)
  8. toShort(byte[] bytes, int index)
  9. toShort(final byte byteValue, final ByteOrder byteOrder)