Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java

Issue 2392643003: Removes files from //build that we don't need (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/device/commands/install_commands.py ('k') | build/android/pylib/device/decorators.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java
diff --git a/build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java b/build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java
deleted file mode 100644
index 7cbbb732ced375ddd0999e551907cee7a8193f98..0000000000000000000000000000000000000000
--- a/build/android/pylib/device/commands/java/src/org/chromium/android/commands/unzip/Unzip.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.android.commands.unzip;
-
-import android.util.Log;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-/**
- * Minimal implementation of the command-line unzip utility for Android.
- */
-public class Unzip {
-
- private static final String TAG = "Unzip";
-
- public static void main(String[] args) {
- try {
- (new Unzip()).run(args);
- } catch (RuntimeException e) {
- Log.e(TAG, e.toString());
- System.exit(1);
- }
- }
-
- private void showUsage(PrintStream s) {
- s.println("Usage:");
- s.println("unzip [zipfile]");
- }
-
- @SuppressWarnings("Finally")
- private void unzip(String[] args) {
- ZipInputStream zis = null;
- try {
- String zipfile = args[0];
- zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipfile)));
- ZipEntry ze = null;
-
- byte[] bytes = new byte[1024];
- while ((ze = zis.getNextEntry()) != null) {
- File outputFile = new File(ze.getName());
- if (ze.isDirectory()) {
- if (!outputFile.exists() && !outputFile.mkdirs()) {
- throw new RuntimeException(
- "Failed to create directory: " + outputFile.toString());
- }
- } else {
- File parentDir = outputFile.getParentFile();
- if (!parentDir.exists() && !parentDir.mkdirs()) {
- throw new RuntimeException(
- "Failed to create directory: " + parentDir.toString());
- }
- OutputStream out = new BufferedOutputStream(new FileOutputStream(outputFile));
- int actual_bytes = 0;
- int total_bytes = 0;
- while ((actual_bytes = zis.read(bytes)) != -1) {
- out.write(bytes, 0, actual_bytes);
- total_bytes += actual_bytes;
- }
- out.close();
- }
- zis.closeEntry();
- }
-
- } catch (IOException e) {
- throw new RuntimeException("Error while unzipping: " + e.toString());
- } finally {
- try {
- if (zis != null) zis.close();
- } catch (IOException e) {
- throw new RuntimeException("Error while closing zip: " + e.toString());
- }
- }
- }
-
- public void run(String[] args) {
- if (args.length != 1) {
- showUsage(System.err);
- throw new RuntimeException("Incorrect usage.");
- }
-
- unzip(args);
- }
-}
-
« no previous file with comments | « build/android/pylib/device/commands/install_commands.py ('k') | build/android/pylib/device/decorators.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698