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
Changes to allow output to be a gzip file #16
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>
please target "release-5.0.1" branch first |
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>
Updated code as suggested. Added buffer=8192 and syncflush parms to open of gzip file, so last record is written , and file is not corrupt. |
@@ -95,15 +99,23 @@ 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.
code below has duplicate lines, which may lead to errors later. more cleaner solution would be to create an object of FileOutputStream, while GZIPOutputStream is overload of such.
var outputStream = null; | |
try { | |
if (outputFileName.endsWith(".gz")) { | |
outputStream = new GZIPOutputStream(new FileOutputStream(outputFileName), 8192, true); | |
} | |
else { | |
outputStream = new FileOutputStream(outputFileName); | |
} | |
} | |
try (TerseDecompresser outputWriter = TerseDecompresser.create(new FileInputStream(inputFileName), outputStream )) | |
{ | |
outputWriter.TextFlag = textMode; | |
outputWriter.decode(); | |
} |
suggested code is just to describe the idea, please test it
Changes to allow output to be a gzip file (if the filename ends with ".gz")