use of com.thoughtworks.xstream.io.copy.HierarchicalStreamCopier in project ddf by codice.
the class GmlGeometryConverter method marshal.
@Override
public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
Geometry geometry = (Geometry) value;
GMLWriter gmlWriter = new GMLWriter();
String gmlXml = gmlWriter.write(geometry);
// Copy the GML XML into the writer
XmlPullParser parser = null;
try {
parser = XppFactory.createDefaultParser();
new HierarchicalStreamCopier().copy(new XppReader(new StringReader(gmlXml), parser), writer);
} catch (XmlPullParserException e) {
LOGGER.debug(ERROR_SERIALIZING_MSG, e);
}
}
use of com.thoughtworks.xstream.io.copy.HierarchicalStreamCopier in project ddf by codice.
the class CswTransformProvider method writeXml.
private void writeXml(BinaryContent content, HierarchicalStreamWriter writer) {
try {
XmlPullParser parser = XppFactory.createDefaultParser();
new HierarchicalStreamCopier().copy(new XppReader(new InputStreamReader(content.getInputStream(), StandardCharsets.UTF_8), parser), writer);
} catch (XmlPullParserException e) {
throw new ConversionException("Unable to copy metadata to XML Output.", e);
}
}
use of com.thoughtworks.xstream.io.copy.HierarchicalStreamCopier in project ddf by codice.
the class MetacardMarshallerImpl method geoToXml.
private String geoToXml(BinaryContent content, XmlPullParser parser) throws UnsupportedEncodingException {
PrintWriter destination;
try (InputStreamReader inputStreamReader = new InputStreamReader(content.getInputStream(), StandardCharsets.UTF_8.name())) {
XppReader source = new XppReader(inputStreamReader, parser);
// if multi-threading, cannot abstract PrintWriter to class member
destination = writerProvider.build(Metacard.class);
new HierarchicalStreamCopier().copy(source, destination);
} catch (IOException e) {
throw new RuntimeException(e);
}
return destination.makeString();
}
Aggregations