Here you can find the source of writeStreamCharwiseLimited(final Reader in, final Writer out, final int len)
public static int writeStreamCharwiseLimited(final Reader in, final Writer out, final int len) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.Reader; import java.io.Writer; public class Main { public static int writeStreamCharwiseLimited(final Reader in, final Writer out, final int len) throws IOException { int read; int count = 0; while (true) { read = in.read();/*from w ww .j a v a 2 s. co m*/ if (read == -1) { return count; } out.write(read); count++; } } }