public static String readStringAndClose(Reader in,int length) throws IOException {
  try {
    if (length <= 0) {
      length=Integer.MAX_VALUE;
    }
    int block=Math.min(Constants.IO_BUFFER_SIZE,length);
    StringWriter out=new StringWriter(block);
    copyAndCloseInput(in,out,length);
    return out.toString();
  }
  finally {
    in.close();
  }
}

public static String readStringAndClose ( Reader in , int length ) throws IOException { try { if ( length <= 0 ) { length = Integer . MAX_VALUE ; } int block = Math . min ( Constants . IO_BUFFER_SIZE , length ) ; StringWriter out = new StringWriter ( block ) ; copyAndCloseInput ( in , out , length ) ; return out . toString ( ) ; } finally { in . close ( ) ; } }
read a number of characters from a reader and close it .
