New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
15 can you please add support to decompress to zipoutputstream #18
base: release-5.0.1
Are you sure you want to change the base?
Conversation
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Restored try clause. Increased GZIP buffer size for effciency and for CryptoCards that only get used if buffer > = 8192 bytes Set GZIP flush option to prevent corruption of file on last write Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Rebased change using existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Rebased using existing 5.0.1 branch Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Rebased using existing 5.0.1 branch. Note this change bumps java to Java 17, and uses Shade to reduce output size Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
trivial indentation fix Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Restored maven jar plug-in Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
Signed-off-by: Russell Shaw <69813534+kiwi1969@users.noreply.github.com>
@@ -0,0 +1,15 @@ | |||
# Declares that this is the top-level configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add .editorconfig to .gitignore too, as it is per developer to setup own
|
||
if (args.length == 0) | ||
parseArgs(args); | ||
if (args.length == 0 || (inputFileName == null && outputFileName == null) || (outputFileName == null && textMode == false) || isHelpRequested == true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CAN BE IGNORED - check for isHelpRequested right after args.length, reasons:
- faster in case of isHelpRequested
- simpler to read code, as it first check simple things, later more complicated
else if (inputFileName == null) { | ||
inputFileName = args[i]; | ||
} | ||
// second non-flag argument is the input file name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like typo, should it be "second non-flag argument is the output file name" ?
} | ||
else // we have more args than we know what to do with | ||
{ | ||
isHelpRequested = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets call break here, as there is no point to run more this loop
@@ -95,18 +103,49 @@ else if (outputFileName == null) | |||
printUsageAndExit(); | |||
} | |||
|
|||
System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an example how it will be more streamlined:
System.out.println("Attempting to decompress input file (" + inputFileName +") to output file (" + outputFileName +")"); | |
System.out.println("Opening output file (" + outputFileName + ")"); | |
var outputStream = null; | |
try { | |
if (outputFileName.endsWith(".gz")) { | |
outputStream = new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true); | |
} | |
else { | |
outputStream = new FileOutputStream(outputFileName); | |
} | |
} | |
catch (Exception e) { | |
System.out.println("Got exception while opening output file (" + outputFileName + ").\nError message:\n" + e.toString()); | |
} | |
System.out.println("Attempting to decompress input file (" + inputFileName + ") to output file (" + outputFileName + ")"); | |
try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), outputStream)) { | |
outputWriter.TextFlag = textMode; | |
outputWriter.decode(); | |
} | |
catch (Exception e) { | |
System.out.println("Got exception while decompressing input file (" + inputFileName + ").\nError message:\n" + e.toString()); | |
} |
Added support for gzip output file.
To do this, simple add ".gz" onto end of output file