cdm/src/main/java/ucar/nc2/util/IO.java
static public String readFile(String filename) throws IOException {
    try (FileInputStream fin = new FileInputStream(filename)) {
      InputStreamReader reader = new InputStreamReader(fin, CDM.utf8Charset);
      StringWriter swriter = new StringWriter(50000);
      UnsynchronizedBufferedWriter writer = new UnsynchronizedBufferedWriter(swriter);
      writer.write(reader);
      return swriter.toString();
    }
  }
static public String readFile(String filename) throws IOException {
    try (FileInputStream fin = new FileInputStream(filename)) {
      InputStreamReader reader = new InputStreamReader(fin, CDM.utf8Charset);
      StringWriter swriter = new StringWriter(50000);
      UnsynchronizedBufferedWriter writer = new UnsynchronizedBufferedWriter(swriter);
      writer.write(reader);
      return swriter.toString();
    }
  }
static public String readFile ( String filename ) throws IOException { try ( FileInputStream fin = new FileInputStream ( filename ) ) { InputStreamReader reader = new InputStreamReader ( fin , CDM . utf8Charset ) ; StringWriter swriter = new StringWriter ( 50000 ) ; UnsynchronizedBufferedWriter writer = new UnsynchronizedBufferedWriter ( swriter ) ; writer . write ( reader ) ; return swriter . toString ( ) ; } }
Read the contents from the named file and place into a String, assuming UTF-8 encoding.

@param filename the URL to read from.
@return String holding the file contents
@throws java.io.IOException on io error
Read the contents from the named file and place into a String assuming UTF - 8 encoding .