Skip to content
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

Ideas for the next 2.0.0 #7

Open
iyxan23 opened this issue Feb 1, 2024 · 0 comments
Open

Ideas for the next 2.0.0 #7

iyxan23 opened this issue Feb 1, 2024 · 0 comments

Comments

@iyxan23
Copy link
Owner

iyxan23 commented Feb 1, 2024

The current API of zipalign is very minimal and a bit too specific (the RandomAccessFile arg). Honestly the original API looks good as-is, and is perfect for its main goal but its a bit hard to maintain the long lines of code. I'm imagining a more object-oriented approach in the next 2.0.0 so it could be called a "real" library 😄

I'm thinking of an API that will look something like this:

ZipAnalyzer analyzer = new ZipAnalyzer("./file.zip");
// or 
ZipAnalyzer analyzer = new ZipAnalyzer(new FileInputStream(...));
// or maybe even
byte[] something = new byte[...];
ZipAnalyzer analyzer = new ZipAnalyzer(something);

analyzer.setAlignSoFiles(true, 4096);
analyzer.specialCase(new AlignCase() { ... }, 16); // perhaps the user wanted to align something specific? X)

Alignments alignments = analyzer.analyze();
alignments.align("./file.zip", "output.zip");
alignments.align(new FileInputStream(...), "output.zip");
alignments.alignInPlace("./file.zip");
byte[] result = alignments.alignToBytes("./file.zip");

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant