Code example for StringWriter

Methods: toString

0
        final String original = toString(fileName);
 
        final InputStream is = getResource(fileName);
        final BundledPatch patch = PatchBundleXml.parse(is);
 
        final StringWriter writer = new StringWriter();
        PatchBundleXml.marshal(writer, patch);
        final String marshalled = writer.toString();
 
        System.out.println(original);
        System.out.println(marshalled);
 
        XMLUtils.compareXml(original, marshalled, false);
    } 
 
    static InputStream getResource(final String name) throws IOException {
        final URL resource = PatchBundleXmlUnitTestCase.class.getClassLoader().getResource(name);
        assertNotNull(name, resource);
        return resource.openStream();
    } 
Contextual code suggestions in your IDE  Get Codota for Java