@Test void testConvert() { byte[] bytes = "<parent><child/></parent>".getBytes(); InputStream inputStream = new ByteArrayInputStream(bytes); Document actual = testSubject.convert(inputStream); assertEquals("parent", actual.getRootElement().getName()); }
@Override public Document convert(InputStream original) { try { return new STAXEventReader().readDocument(new InputStreamReader(original, Charset.forName("UTF-8"))); } catch (XMLStreamException e) { throw new CannotConvertBetweenTypesException("Cannot convert from InputStream to dom4j Document.", e); } }
InputStreamToDom4jConverter implements ContentTypeConverter<InputStream,Document> { @Override public Document convert(InputStream original) { try { return new STAXEventReader().readDocument(new InputStreamReader(original, Charset.forName("UTF-8"))); } catch (XMLStreamException e) { throw new CannotConvertBetweenTypesException("Cannot convert from InputStream to dom4j Document.", e); } } }
InputStreamToDom4jConverter implements ContentTypeConverter<InputStream,Document> { @Override public Document convert(InputStream original) { try { return new STAXEventReader().readDocument(new InputStreamReader(original, Charset.forName("UTF-8"))); } catch (XMLStreamException e) { throw new CannotConvertBetweenTypesException("Cannot convert from InputStream to dom4j Document.", e); } }  }
InputStreamToDom4jConverter implements ContentTypeConverter<InputStream,Document> { @Override public Document convert(InputStream original) { try { return new STAXEventReader().readDocument(new InputStreamReader(original, Charset.forName("UTF-8"))); } catch (XMLStreamException e) { throw new CannotConvertBetweenTypesException("Cannot convert from InputStream to dom4j Document.", e); } }  @Override Class<InputStream> expectedSourceType(); @Override Class<Document> targetType(); @Override Document convert(InputStream original); }
InputStreamToDom4jConverter implements ContentTypeConverter<InputStream,Document> { @Override public Document convert(InputStream original) { try { return new STAXEventReader().readDocument(new InputStreamReader(original, Charset.forName("UTF-8"))); } catch (XMLStreamException e) { throw new CannotConvertBetweenTypesException("Cannot convert from InputStream to dom4j Document.", e); } }  @Override Class<InputStream> expectedSourceType(); @Override Class<Document> targetType(); @Override Document convert(InputStream original);  }