public static void copy(Reader in, Writer out, int num_bytes)
    throws IOException
  {
    if(num_bytes == 0)
      return;

    int n;

    if(num_bytes < 0)
    {
      char[] b = new char[2048];
      while((n = in.read(b, 0, b.length)) > 0)
        out.write(b, 0, n);
    }
    else
    {
      int offset = 0;
      char[] b = new char[num_bytes];
      while(num_bytes > 0 && (n = in.read(b, offset, num_bytes)) > 0)
      {
        offset += n;
        num_bytes -= n;
      }
      out.write(b);
    }
  }
public static void copy(Reader in, Writer out, int num_bytes)
    throws IOException
  {
    if(num_bytes == 0)
      return;

    int n;

    if(num_bytes < 0)
    {
      char[] b = new char[2048];
      while((n = in.read(b, 0, b.length)) > 0)
        out.write(b, 0, n);
    }
    else
    {
      int offset = 0;
      char[] b = new char[num_bytes];
      while(num_bytes > 0 && (n = in.read(b, offset, num_bytes)) > 0)
      {
        offset += n;
        num_bytes -= n;
      }
      out.write(b);
    }
  }
public static void copy ( Reader in , Writer out , int num_bytes ) throws IOException { if ( num_bytes == 0 ) return ; int n ; if ( num_bytes < 0 ) { char [ ] b = new char [ 2048 ] ; while ( ( n = in . read ( b , 0 , b . length ) ) > 0 ) out . write ( b , 0 , n ) ; } else { int offset = 0 ; char [ ] b = new char [ num_bytes ] ; while ( num_bytes > 0 && ( n = in . read ( b , offset , num_bytes ) ) > 0 ) { offset += n ; num_bytes -= n ; } out . write ( b ) ; } }
Copies the reader into the writer (num_bytes)

@param in the reader to read data
@param out the writer to write data
@param num_bytes the number of chars to copy
Copies the reader into the writer ( num_bytes )