Java Code Examples for com.thoughtworks.xstream.XStream#createObjectOutputStream()

The following examples show how to use com.thoughtworks.xstream.XStream#createObjectOutputStream() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public String getEvents() {
    final XStream xstream = createTrustingXStream();
    StringWriter writer = new StringWriter();
    try (final ObjectOutputStream out = xstream.createObjectOutputStream(writer)) {
        out.writeObject( );
    } catch (Throwable t) {
        throw new RuntimeException("Unable to create event output: " + t.getMessage());
    return writer.toString();
Example 2
Source Project: swingsane   File:    License: Apache License 2.0 5 votes vote down vote up
public static void exportScannerXML(XStream xstream, Scanner scanner, File file)
    throws IOException {
  String rootNodeName = "swingsane";
  BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),
  out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  ObjectOutputStream oos;
  oos = xstream.createObjectOutputStream(out, rootNodeName);