• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1zipalign -- zip archive alignment tool
2
3usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
4       zipalign -c [-v] <align> infile.zip
5
6  -c : check alignment only (does not modify file)
7  -f : overwrite existing outfile.zip
8  -v : verbose output
9  <align> is in bytes, e.g. "4" provides 32-bit alignment
10  infile.zip is an existing Zip archive
11  outfile.zip will be created
12
13
14The purpose of zipalign is to ensure that all uncompressed data starts
15with a particular alignment relative to the start of the file.  This
16allows those portions to be accessed directly with mmap() even if they
17contain binary data with alignment restrictions.
18
19Some data needs to be word-aligned for easy access, others might benefit
20from being page-aligned.  The adjustment is made by altering the size of
21the "extra" field in the zip Local File Header sections.  Existing data
22in the "extra" fields may be altered by this process.
23
24Compressed data isn't very useful until it's uncompressed, so there's no
25need to adjust its alignment.
26
27Alterations to the archive, such as renaming or deleting entries, will
28potentially disrupt the alignment of the modified entry and all later
29entries.  Files added to an "aligned" archive will not be aligned.
30
31By default, zipalign will not overwrite an existing output file.  With the
32"-f" flag, an existing file will be overwritten.
33
34You can use the "-c" flag to test whether a zip archive is properly aligned.
35
36