private void checkChecksums(CompressionProperties properties) throws IOException { out.println("Validating checksums."); File logdata = new File(targetFile, logProperties.getVariableDataFile()); if (!properties.getDataChecksum().equals(Files.hash(logdata, Hashing.sha1()).toString())) { throw new IOException("Variable data does not match with pre-compression data. Expect an unloadable data file."); } File index = new File(targetFile, logProperties.getVariablesIndexFile()); if (!properties.getTimestampChecksum().equals(Files.hash(index, Hashing.sha1()).toString())) { throw new IOException("Timestamp data does not match with pre-compression data. A bug has been found in the LogFileDecompressor and fixing it will make this data file readable again."); } out.println("Checksums validated."); }
private void setChecksums(CompressionProperties properties) throws IOException { out.println("Saving checksums to file"); File logdata = new File(logDirectory, logProperties.getVariableDataFile()); properties.setDataChecksum(Files.hash(logdata, Hashing.sha1()).toString()); File index = new File(logDirectory, logProperties.getVariablesIndexFile()); properties.setTimestampChecksum(Files.hash(index, Hashing.sha1()).toString()); out.println("Saved checksums"); }
logLineLength = YoVariableHandshakeParser.getNumberOfVariables(handshakeData); File logdata = new File(logDirectory, logProperties.getVariableDataFile()); if (!logdata.exists()) throw new RuntimeException("Cannot find " + logProperties.getVariableDataFile());
int bufferSize = handshake.getBufferSize(); File logdata = new File(directory, properties.getVariableDataFile()); if (!logdata.exists()) throw new RuntimeException("Cannot find " + properties.getVariableDataFile()); properties.setVariablesIndexFile("robotData.dat"); properties.setTimestampedIndex(true); File compressedData = new File(directory, properties.getVariableDataFile()); File indexData = new File(directory, properties.getVariablesIndexFile());
int logLineLength = YoVariableHandshakeParser.getNumberOfVariables(handshakeData); File logdata = new File(logDirectory, logProperties.getVariableDataFile()); if (!logdata.exists()) throw new RuntimeException("Cannot find " + logProperties.getVariableDataFile());
out.println("Reading " + bufferedElements + " data points at a time"); FileOutputStream outputStream = new FileOutputStream(new File(targetFile, logProperties.getVariableDataFile())); outputChannel = outputStream.getChannel();
monitor.setProgress(10); File outputFile = new File(destination, logProperties.getVariableDataFile()); FileOutputStream fileOutputStream = new FileOutputStream(outputFile); FileChannel outputChannel = fileOutputStream.getChannel();