code: public void write(DataOutput out) throws IOException {
          if (array == null) {
              out.write(NDARRAY_SER_VERSION_HEADER_NULL);
              return;
          }
  
          INDArray toWrite;
          if (array.isView()) {
              toWrite = array.dup();
          } else {
              toWrite = array;
          }
  
          //Write version header: this allows us to maintain backward compatibility in the future,
          // with features such as compression, sparse arrays or changes on the DataVec side
          out.write(NDARRAY_SER_VERSION_HEADER);
          Nd4j.write(toWrite, new DataOutputStream(new DataOutputWrapperStream(out)));
      }
docs: Serialize array data linearly.