/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, XMLStreamWriter output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) { output = new FilteredStreamWriter(output, version); } final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public Node getNode(final Object object) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) { // This exception is thrown by javax.xml.bind.helpers.AbstractMarshallerImpl anyway. throw new UnsupportedOperationException(); } else { final Context context = begin(); try { return marshaller.getNode(toImplementation(object)); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final File output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { try (OutputStream s = new BufferedOutputStream(new FileOutputStream(output))) { marshal(object, OutputFactory.createXMLStreamWriter(s, getEncoding()), version); } } catch (IOException | XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final Writer output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { marshal(object, OutputFactory.createXMLStreamWriter(output), version); } catch (XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final Node output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { marshal(object, OutputFactory.createXMLStreamWriter(output), version); } catch (XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final Result output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { marshal(object, OutputFactory.createXMLStreamWriter(output), version); } catch (XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final ContentHandler output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { marshal(object, OutputFactory.createXMLStreamWriter(output), version); } catch (XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final XMLEventWriter output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { marshal(object, OutputFactory.createXMLStreamWriter(output), version); } catch (XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }
/** * Delegates the marshalling to the wrapped marshaller. */ @Override public void marshal(final Object object, final OutputStream output) throws JAXBException { final FilterVersion version = getFilterVersion(); if (version != null) try { marshal(object, OutputFactory.createXMLStreamWriter(output, getEncoding()), version); } catch (XMLStreamException e) { throw new JAXBException(e); } else { // Marshalling to the default GML version. final Context context = begin(); try { marshaller.marshal(toImplementation(object), output); } finally { context.finish(); } } }