public class FileExtractor extends Object
| Constructor and Description |
|---|
FileExtractor(boolean overwriteFilesThatExist) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
copyFileToDisk(InputStream inputStream,
String pathToExtractTo,
String filename)
Copy a file from an inputsteam to disk
|
String |
extractFileFromArchive(File downloadedCompressedFile,
String extractedToFilePath,
BinaryType possibleFilenames)
Extract binary from a downloaded archive file
|
protected String |
untarFile(InputStream compressedFileInputStream,
String extractedToFilePath,
BinaryType possibleFilenames)
Untar a decompressed tar file (this will implicitly overwrite any existing files)
|
protected String |
unzipFile(File downloadedCompressedFile,
String extractedToFilePath,
BinaryType possibleFilenames)
Unzip a downloaded zip file (this will implicitly overwrite any existing files)
|
public FileExtractor(boolean overwriteFilesThatExist)
overwriteFilesThatExist - Overwrite any existing filespublic String extractFileFromArchive(File downloadedCompressedFile, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, IllegalArgumentException, org.apache.maven.plugin.MojoFailureException
downloadedCompressedFile - The downloaded compressed fileextractedToFilePath - Path to extracted filepossibleFilenames - Names of the files we want to extractIOException - Unable to write to filesystemIllegalArgumentException - Unsupported archiveorg.apache.maven.plugin.MojoFailureException - Error running pluginprotected String unzipFile(File downloadedCompressedFile, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, ExpectedFileNotFoundException
downloadedCompressedFile - The downloaded zip fileextractedToFilePath - Path to extracted filepossibleFilenames - Names of the files we want to extractIOExceptionExpectedFileNotFoundExceptionprotected String untarFile(InputStream compressedFileInputStream, String extractedToFilePath, BinaryType possibleFilenames) throws IOException, ExpectedFileNotFoundException
compressedFileInputStream - The expanded tar fileextractedToFilePath - Path to extracted filepossibleFilenames - Names of the files we want to extractIOException - MojoFailureExceptionExpectedFileNotFoundExceptionprotected String copyFileToDisk(InputStream inputStream, String pathToExtractTo, String filename) throws IOException
inputStream - A valid iput stream to readpathToExtractTo - Path of the file we want to createfilename - Filename of the file we want to createIOExceptionCopyright © 2016. All rights reserved.