code: public void setData(InputStream in) throws IOException {
          m_dirty = true;
          FileOutputStream out = new FileOutputStream(m_dataFile);
          byte[] buf = new byte[4096];
          int i = 0;
          m_size = 0;
          while ((i = in.read(buf)) != -1) {
              m_size += i;
              out.write(buf, 0, i);
          }
          in.close();
          out.close();
      }
docs: Reads the bytes from the given <code>InputStream</code> as the data for
  this digital object. When finished, the <code>InputStream</code> is
  closed.