use of org.apache.commons.io.output.NullOutputStream in project jackrabbit-oak by apache.
the class ConsolidatedDataStoreStatsTest method getIdForInputStream.
private String getIdForInputStream(final InputStream in) throws Exception {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
OutputStream output = new DigestOutputStream(new NullOutputStream(), digest);
try {
IOUtils.copyLarge(in, output);
} finally {
IOUtils.closeQuietly(output);
IOUtils.closeQuietly(in);
}
return encodeHexString(digest.digest());
}
use of org.apache.commons.io.output.NullOutputStream in project jackrabbit-oak by apache.
the class CachingDataStoreTest method getIdForInputStream.
private String getIdForInputStream(File f) throws Exception {
FileInputStream in = null;
OutputStream output = null;
try {
in = new FileInputStream(f);
MessageDigest digest = MessageDigest.getInstance("SHA-256");
output = new DigestOutputStream(new NullOutputStream(), digest);
IOUtils.copyLarge(in, output);
return encodeHexString(digest.digest());
} finally {
IOUtils.closeQuietly(output);
IOUtils.closeQuietly(in);
}
}
use of org.apache.commons.io.output.NullOutputStream in project jackrabbit by apache.
the class BigFileReadTest method runTest.
public void runTest() throws Exception {
Node file = root.getNode("file" + (i++ % FILE_COUNT));
Node content = file.getNode("jcr:content");
InputStream stream = content.getProperty("jcr:data").getStream();
try {
IOUtils.copy(stream, new NullOutputStream());
} finally {
stream.close();
}
}
use of org.apache.commons.io.output.NullOutputStream in project jackrabbit by apache.
the class SmallFileReadTest method runTest.
public void runTest() throws Exception {
for (int i = 0; i < FILE_COUNT; i++) {
Node file = root.getNode("file" + i);
Node content = file.getNode("jcr:content");
InputStream stream = content.getProperty("jcr:data").getStream();
try {
IOUtils.copy(stream, new NullOutputStream());
} finally {
stream.close();
}
}
}
use of org.apache.commons.io.output.NullOutputStream in project webservices-axiom by apache.
the class TestGetPrefixAfterWriteNamespace method runTest.
protected void runTest() throws Throwable {
XMLStreamWriter writer = staxImpl.newNormalizedXMLOutputFactory().createXMLStreamWriter(new NullOutputStream());
writer.writeStartElement("", "root", "");
writer.writeNamespace("p", "urn:test");
assertEquals("p", writer.getPrefix("urn:test"));
}
Aggregations