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
Source Project: kogito-runtimes File: WorkingMemoryInMemoryLogger.java License: Apache License 2.0 | 5 votes |
public String getEvents() { final XStream xstream = createTrustingXStream(); StringWriter writer = new StringWriter(); try (final ObjectOutputStream out = xstream.createObjectOutputStream(writer)) { out.writeObject( this.events ); } catch (Throwable t) { throw new RuntimeException("Unable to create event output: " + t.getMessage()); } return writer.toString(); }
Example 2
Source Project: swingsane File: PreferencesUtils.java License: Apache License 2.0 | 5 votes |
public static void exportScannerXML(XStream xstream, Scanner scanner, File file) throws IOException { String rootNodeName = "swingsane"; BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); ObjectOutputStream oos; oos = xstream.createObjectOutputStream(out, rootNodeName); oos.writeObject(scanner); oos.close(); }