/** * Uncompress a file to a temporary file. * * @param context Step context * @param file file to uncompress * @return the path to the uncompressed file * @throws IOException if an error occurs while creating the uncompressed file */ private File uncompressFile(final TaskContext context, final DataFile file) throws IOException { checkNotNull(file, "file argument cannot be null"); final DataFile realFile; final DataProtocol protocol = file.getProtocol(); // Get the underlying file if the file protocol is a storage protocol if (protocol instanceof StorageDataProtocol) { realFile = ((StorageDataProtocol) protocol).getUnderLyingData(file); } else { realFile = file; } final File outputFile = Files.createTempFile( context.getLocalTempDirectory().toPath(), MODULE_NAME + "-", realFile.getExtension()) .toFile(); context.getLogger().fine("Uncompress/copy " + realFile + " to " + outputFile); DataFiles.copy(realFile, new DataFile(outputFile)); return outputFile; }