public static String copyToString(Reader in) throws IOException {
  StringWriter out=new StringWriter();
  copy(in,out);
  String str=out.toString();
  if (str.startsWith("\ufeff")) {
    return str.substring(1);
  }
  return str;
}

public static String copyToString ( Reader in ) throws IOException { StringWriter out = new StringWriter ( ) ; copy ( in , out ) ; String str = out . toString ( ) ; if ( str . startsWith ( "﻿" ) ) { return str . substring ( 1 ) ; } return str ; }
copy the contents of the given reader into a string . closes the reader when done .
