Here you can find the source of readAsciiString(MappedByteBuffer buffer, int pos, int length)
public static String readAsciiString(MappedByteBuffer buffer, int pos, int length)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.nio.MappedByteBuffer; public class Main { public static String readAsciiString(MappedByteBuffer buffer, int pos, int length) { byte[] target = new byte[length]; getBytes(buffer, pos, target);/*from ww w . ja v a2 s .c om*/ return new String(target); } public static void getBytes(MappedByteBuffer buffer, int pos, byte[] target) { for (int i = 0; i < target.length; ++i) { target[i] = buffer.get(pos + i); } } }