WorkerHelper { public static void shredInputStream(final NodeWriteTrx wtx, final InputStream value, final Insert child) { final XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLEventReader parser; try { parser = factory.createXMLEventReader(value); } catch (final XMLStreamException xmlse) { throw new WebApplicationException(xmlse); } try { final XMLShredder shredder = new XMLShredder.Builder(wtx, parser, child) .commitAfterwards().build(); shredder.call(); } catch (final Exception exce) { throw new WebApplicationException(exce); } } private  WorkerHelper(); static void shredInputStream(final NodeWriteTrx wtx,
			final InputStream value, final Insert child); static boolean checkExistingResource(final File storagePath,
			final String resource); static XMLSerializer serializeXML(final Session session,
			final OutputStream out, final boolean serializeXMLDec,
			final boolean serializeRest, final Integer revision); static XMLSerializer serializeXML(final Session session,
			final OutputStream out, final boolean serializeXMLDec,
			final boolean serializeRest, final Long nodekey, final Integer revision); StringBuilder createStringBuilderObject(); static void closeWTX(final boolean abortTransaction,
			final NodeWriteTrx wtx, final Session ses, final Database dbase); static void closeRTX(final NodeReadTrx rtx, final Session ses,
			final Database dbase); IDAccessType validateAccessType(final String accessType); static WorkerHelper getInstance();  }
@Test public void testShredInputStream() throws SirixException, IOException { long lastRevision = sirix.getLastRevision(RESOURCENAME); final Database database = Databases.openDatabase(DBFILE.getParentFile()); final Session session = database .getSession(new SessionConfiguration.Builder(DBFILE.getName()).build()); final NodeWriteTrx wtx = session.beginNodeWriteTrx(); wtx.moveToFirstChild(); final InputStream inputStream = new ByteArrayInputStream( "<testNode/>".getBytes()); WorkerHelper.shredInputStream(wtx, inputStream, Insert.ASFIRSTCHILD); assertEquals("test shred input stream", sirix.getLastRevision(RESOURCENAME), ++lastRevision); wtx.close(); session.close(); database.close(); inputStream.close(); }