Java Code Examples for com.thoughtworks.xstream.XStream#createObjectOutputStream()
The following examples show how to use
com.thoughtworks.xstream.XStream#createObjectOutputStream() .
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 File: WorkingMemoryInMemoryLogger.java From kogito-runtimes with 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 File: PreferencesUtils.java From swingsane with 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(); }