use of org.apache.cassandra.io.util.SequentialWriter in project cassandra by apache.
the class TokenTreeTest method buildTree.
private static TokenTree buildTree(TokenTreeBuilder builder) throws Exception {
builder.finish();
final File treeFile = FileUtils.createTempFile("token-tree-", "db");
treeFile.deleteOnExit();
try (SequentialWriter writer = new SequentialWriter(treeFile, DEFAULT_OPT)) {
builder.write(writer);
writer.sync();
}
final RandomAccessReader reader = RandomAccessReader.open(treeFile);
return new TokenTree(new MappedBuffer(reader));
}
use of org.apache.cassandra.io.util.SequentialWriter in project eiger by wlloyd.
the class SSTableWriter method maybeWriteDigest.
private void maybeWriteDigest() throws IOException {
byte[] digest = dataFile.digest();
if (digest == null)
return;
SequentialWriter out = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_DIGEST)), true);
// Writting output compatible with sha1sum
Descriptor newdesc = descriptor.asTemporary(false);
String[] tmp = newdesc.filenameFor(SSTable.COMPONENT_DATA).split(Pattern.quote(File.separator));
String dataFileName = tmp[tmp.length - 1];
out.write(String.format("%s %s", Hex.bytesToHex(digest), dataFileName).getBytes());
out.close();
}
Aggregations