@Override public HierarchicalStreamWriter createWriter(Writer out) { return new CompactWriter(out); }
public void marshalWriter(Object graph, Writer writer, @Nullable DataHolder dataHolder) throws XmlMappingException, IOException { if (this.streamDriver != null) { doMarshal(graph, this.streamDriver.createWriter(writer), dataHolder); } else { doMarshal(graph, new CompactWriter(writer), dataHolder); } }
String strXML = ""; XStream xs = new XStream(); StringWriter sw = new StringWriter(); xs.marshal(this, new CompactWriter(sw)); strXML = sw.toString();
static void writeToXml(Serializable serializable, BufferedOutputStream bufferedOutput) throws IOException { final XStream xstream = createXStream(false); // on wrappe avec un CompactWriter pour gagner 25% en taille de flux (retours chariots) // et donc un peu en performances final CompactWriter writer = new CompactWriter( new OutputStreamWriter(bufferedOutput, XML_CHARSET_NAME)); try { xstream.marshal(serializable, writer); } finally { writer.close(); } }
xStream.marshal(o, new CompactWriter(new OutputStreamWriter(stream, encoding)));
public static String toXml(final Object o) { final Writer writer = new StringWriter(); XSTREAM_INSTANCE.marshal(o, new CompactWriter(writer)); return writer.toString(); }
@Override public HierarchicalStreamWriter createWriter(Writer out) { return new CompactWriter(out); }
@Override public HierarchicalStreamWriter createWriter(Writer out) { return new CompactWriter(out); }
public static String toXML(Object instance) { XStream xs = new XStream(); StringWriter writer = new StringWriter(); xs.marshal(instance, new CompactWriter(writer)); return writer.toString(); }
public void serialize(Object object, OutputStream output) throws Exception { xstream.marshal(object, new CompactWriter(new OutputStreamWriter(output))); }
@Override public HierarchicalStreamWriter createWriter(Writer out) { return new CompactWriter(out, xmlFriendlyReplacer()); }
public void serialize(Object object, OutputStream output) throws Exception { xstream.marshal(object, new CompactWriter(new OutputStreamWriter(output))); }
synchronized void sendRemoteMessage(final Message message) { CharArrayWriter writer = new CharArrayWriter(); xstream.marshal(message, new CompactWriter(writer)); sendRemoteMessage(writer.toString()); logger.log(Level.FINE, "sent: {0}", writer); }
@Override public void writeTo( Object o, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> map, OutputStream stream ) throws IOException, WebApplicationException { String encoding = getCharsetAsString( mediaType ); xstream.marshal( o, new CompactWriter( new OutputStreamWriter( stream, encoding ) ) ); }
protected HierarchicalStreamWriter getWriter() { try { PrintWriter writer = response.getWriter(); return indented ? new PrettyPrintWriter(writer) : new CompactWriter(writer); } catch (IOException e) { throw new ResultException("Unable to serialize data", e); } }
/** * write a string representation to an outputstream * @param object to write to output * @param writer to write to (e.g. back to http client) */ @Override public void writeString(Object object, Writer writer) { XStream xstream = xstream(false); //dont indent xstream.marshal(object, new CompactWriter(writer)); }
static void writeToXml(Serializable serializable, BufferedOutputStream bufferedOutput) throws IOException { final XStream xstream = createXStream(false); // on wrappe avec un CompactWriter pour gagner 25% en taille de flux (retours chariots) // et donc un peu en performances final CompactWriter writer = new CompactWriter( new OutputStreamWriter(bufferedOutput, XML_CHARSET_NAME)); try { xstream.marshal(serializable, writer); } finally { writer.close(); } }
public void writeTo(final Object o, final Class<?> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, Object> httpHeaders, final OutputStream entityStream) throws IOException, WebApplicationException { Charset cs = ReaderWriter.getCharset(mediaType); XStream xs = getXStream(type); xs.marshal(o, new CompactWriter(new OutputStreamWriter(entityStream, cs))); } }
/** * {@inheritDoc} */ @Override public String toXml(Dto dto) { dto.setXmlns(EsendexProperties.instance().getProperty( EsendexProperties.Key.NAMESPACE)); String declaration = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; StringWriter writer = new StringWriter(); xStream.marshal(dto, new CompactWriter(writer)); String xml = declaration + writer.toString(); return xml; }
protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException { if (streamDriver != null) { marshal(graph, streamDriver.createWriter(writer)); } else { marshal(graph, new CompactWriter(writer)); } }