cdm/src/main/java/ucar/nc2/stream/NcStreamReader.java
public DataResult readData(InputStream is, NetcdfFile ncfile, String location) throws IOException {
    byte[] b = new byte[4];
    int bytesRead = NcStream.readFully(is, b);
    if (bytesRead < b.length)
      throw new EOFException(location);

    if (NcStream.test(b,NcStream.MAGIC_DATA)) return readData1(is, ncfile);
    if (NcStream.test(b,NcStream.MAGIC_DATA2)) return readData2(is);

    throw new IOException("Data transfer corrupted on " + location);
  }
public DataResult readData(InputStream is, NetcdfFile ncfile, String location) throws IOException {
    byte[] b = new byte[4];
    int bytesRead = NcStream.readFully(is, b);
    if (bytesRead < b.length)
      throw new EOFException(location);

    if (NcStream.test(b,NcStream.MAGIC_DATA)) return readData1(is, ncfile);
    if (NcStream.test(b,NcStream.MAGIC_DATA2)) return readData2(is);

    throw new IOException("Data transfer corrupted on " + location);
  }
Read the result of a data request. Only one variable at a time.

@param is     read from input stream
@param ncfile need the metadata from here to interpret structure data
@return DataResult
@throws IOException on read error