use of org.eclipse.rdf4j.rio.binary.BinaryRDFWriter in project rdf4j by eclipse.
the class BinaryHandlingTest method writeBinary.
/**
* Helper method to write the given model to N-Triples and return an InputStream containing the results.
*
* @param statements
* @return An {@link InputStream} containing the results.
* @throws RDFHandlerException
*/
private InputStream writeBinary(Model statements) throws RDFHandlerException {
ByteArrayOutputStream output = new ByteArrayOutputStream(8096);
RDFWriter binaryWriter = new BinaryRDFWriter(output);
binaryWriter.startRDF();
for (Statement nextStatement : statements) {
binaryWriter.handleStatement(nextStatement);
}
binaryWriter.endRDF();
return new ByteArrayInputStream(output.toByteArray());
}
Aggregations