cdm/src/main/java/ucar/nc2/util/IO.java
static public byte[] readContentsToByteArray(InputStream is) throws IOException {
    ByteArrayOutputStream bout = new ByteArrayOutputStream(10 * default_file_buffersize);
    IO.copy(is, bout);
    return bout.toByteArray();
  }
static public byte[] readContentsToByteArray(InputStream is) throws IOException {
    ByteArrayOutputStream bout = new ByteArrayOutputStream(10 * default_file_buffersize);
    IO.copy(is, bout);
    return bout.toByteArray();
  }
static public byte [ ] readContentsToByteArray ( InputStream is ) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream ( 10 * default_file_buffersize ) ; IO . copy ( is , bout ) ; return bout . toByteArray ( ) ; }
Read the contents from the inputStream and place into a byte array,
with any error messages  put in the return String.

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