Java XML JAXB Serialize serialize(final Object object)

Here you can find the source of serialize(final Object object)

Description

serialize

License

Open Source License

Declaration

public static final String serialize(final Object object) throws JAXBException, IOException 

Method Source Code

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

import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.bind.JAXBException;

public class Main {
    public static final String serialize(final Object object) throws JAXBException, IOException {
        OutputStream outputStream = new ByteArrayOutputStream();
        ObjectMapper mapper = new ObjectMapper();
        mapper.writeValue(outputStream, object);
        return outputStream.toString();
    }/*from   w w  w .j  a va2  s  .  com*/
}

Related

  1. saveObject(Path path, T object)
  2. saveObject(T object, Class typeClass, URL path)
  3. saveToFile(String fileName, T obj)
  4. saveXML(Object object, String fileNamePath, Boolean append)
  5. serialiseObject(Object obj, Class objclass)
  6. serialize(JAXBElement emp, Class clazz, OutputStream out)
  7. serialize(JAXBElement object)
  8. serialize(Object o, OutputStream os, Boolean format)
  9. serialize(Object o, OutputStream os, Boolean format)