Here you can find the source of parseContent(ByteBuffer buffer, int offset, int length)
public static String parseContent(ByteBuffer buffer, int offset, int length) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; public class Main { public static String parseContent(ByteBuffer buffer, int offset, int length) throws IOException { // InputStream inputStream = new ByteBufferBackedInputStream(buffer); // InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "ISO-8859-1"); // BufferedReader bufferedReader = null; byte[] chunk = new byte[length]; char[] start = new char[length]; try {/* w w w . j a va 2 s . c o m*/ // bufferedReader = new BufferedReader(inputStreamReader); // bufferedReader.read(start, offset, length); buffer.get(chunk, offset, length); return new String(chunk, StandardCharsets.ISO_8859_1); // return String.valueOf(start); } finally { buffer.rewind(); // bufferedReader.close(); } } }