cdm/src/main/java/ucar/nc2/util/IO.java
static public byte[] readFileToByteArray(String filename) throws IOException {
    try (FileInputStream fin = new FileInputStream(filename)) {
      InputStream in = new BufferedInputStream(fin);
      return readContentsToByteArray(in);
    }
  }
static public byte[] readFileToByteArray(String filename) throws IOException {
    try (FileInputStream fin = new FileInputStream(filename)) {
      InputStream in = new BufferedInputStream(fin);
      return readContentsToByteArray(in);
    }
  }
static public byte [ ] readFileToByteArray ( String filename ) throws IOException { try ( FileInputStream fin = new FileInputStream ( filename ) ) { InputStream in = new BufferedInputStream ( fin ) ; return readContentsToByteArray ( in ) ; } }
Read the file and place contents into a byte array,
with any error messages  put in the return String.

@param filename the file to read from.
@return byte[] holding the contents, or an error message.
@throws java.io.IOException on io error
Read the file and place contents into a byte array with any error messages put in the return String .