Code example for StringWriter

Methods: toString

0
        final String original = toString(fileName);
 
        final InputStream is = getResource(fileName);
        final Patch patch = PatchXml.parse(is).resolvePatch(null, null);
 
        final StringWriter writer = new StringWriter();
        PatchXml.marshal(writer, patch);
        final String marshalled = writer.toString();
 
        XMLUtils.compareXml(original, marshalled, false);
    } 
 
    static InputStream getResource(String name) throws IOException {
        final URL resource = PatchXmlUnitTestCase.class.getClassLoader().getResource(name);
        assertNotNull(name, resource);
        return resource.openStream();
    } 
 
    private String toString(String fileName) throws Exception {
        final InputStream is = getResource(fileName);
Experience pair programming with AI  Get Codota for Java