Java XML JAXB Marshaller marshallMessage(Object message, Marshaller marshaller, DataOutputStream dos)

Here you can find the source of marshallMessage(Object message, Marshaller marshaller, DataOutputStream dos)

Description

marshall Message

License

Open Source License

Declaration

public static void marshallMessage(Object message, Marshaller marshaller, DataOutputStream dos)
            throws JAXBException, IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayOutputStream;

import java.io.DataOutputStream;
import java.io.IOException;

import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

public class Main {
    public static void marshallMessage(Object message, Marshaller marshaller, DataOutputStream dos)
            throws JAXBException, IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshal(message, baos);
        byte[] buff = baos.toByteArray();
        dos.writeInt(buff.length);//  ww  w  .  java 2  s. c  o  m
        dos.write(buff);
        dos.flush();
    }
}

Related

  1. marshall(String file, JAXBElement object, Class context)
  2. marshaller(Object o, Class T)
  3. marshaller(Object obj, File file)
  4. marshallerObject(Class c, Object o)
  5. marshallJAXBObject(String namespace, Object o)
  6. marshallObjectAsString(Class clazz, T object)
  7. marshallObjectToXML(final Object jaxbModel, final URL schemaURL)
  8. marshallToString(Object jaxbElement, Class c)
  9. marshallToXml(String zpackage, Writer writer, Object data)