code: public static org.fcrepo.server.types.mtom.gen.MIMETypedStream convertMIMETypedStreamToGenMIMETypedStreamMTOM(org.fcrepo.server.storage.types.MIMETypedStream mimeTypedStream) {
          if (mimeTypedStream != null) {
              org.fcrepo.server.types.mtom.gen.MIMETypedStream genMIMETypedStream =
                      new org.fcrepo.server.types.mtom.gen.MIMETypedStream();
              genMIMETypedStream.setMIMEType(mimeTypedStream.getMIMEType());
              org.fcrepo.server.storage.types.Property[] header =
                      mimeTypedStream.header;
              org.fcrepo.server.types.mtom.gen.MIMETypedStream.Header head =
                      new org.fcrepo.server.types.mtom.gen.MIMETypedStream.Header();
              if (header != null) {
                  for (org.fcrepo.server.storage.types.Property property : header) {
                      head.getProperty()
                              .add(convertPropertyToGenProperty(property));
                  }
              }
              genMIMETypedStream.setHeader(head);
  
              InputStreamDataSource ds = new InputStreamDataSource(mimeTypedStream.getStream(), mimeTypedStream.getMIMEType());
              genMIMETypedStream
                      .setStream(new DataHandler(ds));
              return genMIMETypedStream;
  
          } else {
              return null;
          }
      }
docs: the standard and MTOM implementations