Package net.e175.klaus.zip
Class ZipPrefixer
java.lang.Object
net.e175.klaus.zip.ZipPrefixer
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidadjustZipOffsets(Path targetPath, long adjustment) Adjust offsets in ZIP file (with validation).static longapplyPrefixes(Path targetPath, byte[]... prefixes) Prepend prefix(es) to an existing file.static longapplyPrefixes(Path targetPath, List<Path> prefixFiles) Prepend prefix files to an existing file.static voidRudimentary CLI intended for testing only.static voidvalidateZipOffsets(Path targetPath) Validate current offsets in ZIP file.
-
Method Details
-
applyPrefixes
Prepend prefix(es) to an existing file. This method does not care about file types or contents, it just mechanically glues the bytes together.- Parameters:
targetPath- Target file. Must be writeable, in a writeable directory with enough space to hold a temporary copy.prefixes- Binary prefixes that will be sequentially written before the original file's contents.- Returns:
- Total number of bytes written as prefixes.
- Throws:
IOException- on I/O related errors
-
applyPrefixes
Prepend prefix files to an existing file. This method does not care about file types or contents, it just mechanically glues the bytes together.- Parameters:
targetPath- Target file. Must be writeable, in a writeable directory with enough space to hold a temporary copy.prefixFiles- Prefix files that will be sequentially written before the original file's contents.- Returns:
- Total number of bytes written as prefixes.
- Throws:
IOException- on I/O related errors
-
validateZipOffsets
Validate current offsets in ZIP file.- Parameters:
targetPath- ZIP file to process.- Throws:
IOException- On I/O errors.ZipException- On errors in the ZIP's integrity.
-
adjustZipOffsets
Adjust offsets in ZIP file (with validation). If adjustment is 0, don't write anything, just validate.- Parameters:
targetPath- ZIP file to process.adjustment- Offset to add to the current offsets.- Throws:
IOException- On I/O errors.ZipException- On errors in the ZIP's integrity.
-
main
Rudimentary CLI intended for testing only.- Throws:
IOException
-