public static void tarDirectory(Path outputFile, Path inputDirectory) throws IOException { tarDirectory(outputFile, inputDirectory, Collections.emptyList()); }
public static void untar(Path outputDirectory, Path inputTarFile) throws IOException { try (FileInputStream fileInputStream = new FileInputStream(inputTarFile.toFile())) { untar(outputDirectory, fileInputStream); } }
public static void untar(Path outputDirectory, Path inputTarFile) throws IOException { try (FileInputStream fileInputStream = new FileInputStream(inputTarFile.toFile())) { untar(outputDirectory, fileInputStream); } }
Path createResultArchive(Long projectID, WindupExecution execution, Path outputDirectory) { try { Files.createDirectories(outputDirectory); Path tempFile = outputDirectory.resolve("report_files.tar"); TarUtil.tarDirectory(tempFile, Paths.get(execution.getOutputPath())); return tempFile; } catch (IOException e) { throw new RuntimeException("Failed to create result archive due to: " + e.getMessage(), e); } } }
private WindupExecution deserializeStatusUpdateFromStream(StreamMessage streamMessage, WindupExecution lastStatusFromDB) { // this is a results message with final result contents, untar the results try { Path outputPath = Paths.get(lastStatusFromDB.getOutputPath()); Path tempFile = outputPath.resolve("report_files.tar"); streamMessage.setObjectProperty(AMQConstants.AMQ_LARGE_MESSAGE_SAVESTREAM_PROPERTY, new FileOutputStream(tempFile.toFile())); TarUtil.untar(outputPath, tempFile); } catch (Exception e) { LOG.log(Level.SEVERE, "Error handling status result with contents due to: " + e.getMessage(), e); } return lastStatusFromDB; }