public static void copy(Reader reader,boolean closeIn,Appendable out) throws IOException {
  try {
    CharBuffer buffer=CharBuffer.allocate(4096);
    while (reader.read(buffer) > 0) {
      buffer.flip();
      buffer.rewind();
      out.append(buffer);
    }
  }
  finally {
    if (closeIn)     IOUtils.closeQuietly(reader);
  }
}

public static void copy ( Reader reader , boolean closeIn , Appendable out ) throws IOException { try { CharBuffer buffer = CharBuffer . allocate ( 4096 ) ; while ( reader . read ( buffer ) > 0 ) { buffer . flip ( ) ; buffer . rewind ( ) ; out . append ( buffer ) ; } } finally { if ( closeIn ) IOUtils . closeQuietly ( reader ) ; } }
copy a reader to an appendable , optionally closing the input .
