location.writeExternal(dos);
return dos.toByteArray();
}
public static Journal createJournal(String dirPath, int fileSize, int writeBatchSize) {
Journal journal = new Journal();
File directory = new File(dirPath);
//noinspection ResultOfMethodCallIgnored
directory.mkdirs();
journal.setDirectory(directory);
journal.setMaxFileLength(fileSize);
journal.setMaxWriteBatchSize(writeBatchSize);
try {
journal.open();
} catch (IOException e) {
throw new RuntimeException(e);
}
return journal;
}