Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import java.io.File; | 5 import java.io.File; |
| 6 import java.io.FileOutputStream; | 6 import java.io.FileOutputStream; |
| 7 import java.io.IOException; | 7 import java.io.IOException; |
| 8 import java.io.InputStream; | 8 import java.io.InputStream; |
| 9 import java.io.OutputStream; | 9 import java.io.OutputStream; |
| 10 import java.util.ArrayList; | 10 import java.util.ArrayList; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 | 300 |
| 301 List<JarEntry> entries = getOutputFileOrderEntries(in, addAlignment, ren ame); | 301 List<JarEntry> entries = getOutputFileOrderEntries(in, addAlignment, ren ame); |
| 302 long timestamp = System.currentTimeMillis(); | 302 long timestamp = System.currentTimeMillis(); |
| 303 byte[] buffer = new byte[4096]; | 303 byte[] buffer = new byte[4096]; |
| 304 boolean firstEntry = true; | 304 boolean firstEntry = true; |
| 305 String prevName = null; | 305 String prevName = null; |
| 306 int numCrazy = 0; | 306 int numCrazy = 0; |
| 307 for (JarEntry inEntry : entries) { | 307 for (JarEntry inEntry : entries) { |
| 308 // Rename files, if specied. | 308 // Rename files, if specied. |
| 309 String name = outputName(inEntry, rename); | 309 String name = outputName(inEntry, rename); |
| 310 if (name.endsWith(".apk")) { | 310 if (name.endsWith(".apk") && !name.endsWith("MintingExample.template .apk")) { |
|
Yaron
2016/02/19 22:10:20
You don't need to do this now but I suspect that w
Xi Han
2016/02/24 19:09:38
That is a option to keep in mind:)
| |
| 311 throw new UnsupportedOperationException( | 311 throw new UnsupportedOperationException( |
| 312 "Nested APKs are not supported: " + name); | 312 "Nested APKs are not supported: " + name); |
| 313 } | 313 } |
| 314 | 314 |
| 315 // Build the header. | 315 // Build the header. |
| 316 JarEntry outEntry = null; | 316 JarEntry outEntry = null; |
| 317 boolean isCrazy = isCrazyLibraryFilename(name); | 317 boolean isCrazy = isCrazyLibraryFilename(name); |
| 318 if (isCrazy) { | 318 if (isCrazy) { |
| 319 // "crazy" libraries are alway output uncompressed (STORED). | 319 // "crazy" libraries are alway output uncompressed (STORED). |
| 320 outEntry = makeStoredEntry(name, inEntry, in); | 320 outEntry = makeStoredEntry(name, inEntry, in); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 outputJar.setLevel(9); | 439 outputJar.setLevel(9); |
| 440 | 440 |
| 441 rezip(inputJar, outputJar, outCount, addAlignment, rename); | 441 rezip(inputJar, outputJar, outCount, addAlignment, rename); |
| 442 outputJar.close(); | 442 outputJar.close(); |
| 443 } finally { | 443 } finally { |
| 444 if (inputJar != null) inputJar.close(); | 444 if (inputJar != null) inputJar.close(); |
| 445 if (outputFile != null) outputFile.close(); | 445 if (outputFile != null) outputFile.close(); |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 } | 448 } |
| OLD | NEW |