Here you can find the source of trimArray(char[] buffer, int read)
private static char[] trimArray(char[] buffer, int read)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { private static char[] trimArray(char[] buffer, int read) { if (buffer.length != read) { return Arrays.copyOf(buffer, read); } else {/* w w w . jav a 2 s . c o m*/ return buffer; } } }