Skip to content

Ideas for the next 2.0.0 #7

@iyxan23

Description

@iyxan23

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions