-
Notifications
You must be signed in to change notification settings - Fork 17
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 <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
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 <[email protected]>
Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <[email protected]>
Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <[email protected]>
Rebased change using existing 5.0.1 branch Signed-off-by: Russell Shaw <[email protected]>
Rebased upon existing 5.0.1 branch Signed-off-by: Russell Shaw <[email protected]>
Rebased using existing 5.0.1 branch Signed-off-by: Russell Shaw <[email protected]>
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 <[email protected]>
trivial indentation fix Signed-off-by: Russell Shaw <[email protected]>
Restored maven jar plug-in Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
.editorconfig
Outdated
@@ -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
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.
Done
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.
Note this now means that the default tabsize when viewing in github is 8, which was what I was initially trying to correct
|
||
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
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.
Um, this is the other dude's change I merged with. Updated
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" ?
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.
I think this is part of the other guy's change I merged with. Updated now
} | ||
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
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.
Again, this was the previous dudes change I was asked to merged with. Updated.
@@ -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()); | |
} |
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.
Updated
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Simplied, and actually still works Signed-off-by: Russell Shaw <[email protected]>
Signed-off-by: Russell Shaw <[email protected]>
Improved outfilename suffix defaults Signed-off-by: Russell Shaw <[email protected]>
Hello @kiwi1969 , code looks good now.
|
FYI - using this code I was successfully able to Unterse a binary SMF110.trs file into a .gz file which is approx half the size. |
As requested Signed-off-by: Russell Shaw <[email protected]>
updated version string and date Signed-off-by: Russell Shaw <[email protected]>
Fix -b detection Signed-off-by: Russell Shaw <[email protected]>
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.
Hello @kiwi1969 , as i mentioned before, code looks good, but the branch has conflicts:
Conflicting files
.gitignore
pom.xml
src/main/java/org/openmainframeproject/tersedecompress/TerseDecompress.java
FYI - as I do not have write access to repo, I cannot merge pull requests to resolve conflicts |
there is no need of write access to repo to resolve a merge conflict, you shall rebase your changes on top of target branch. |
Added support for gzip output file.
To do this, simple add ".gz" onto end of output file