summaryrefslogtreecommitdiffstats
path: root/src/proguard/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/proguard/io')
-rw-r--r--src/proguard/io/CascadingDataEntryWriter.java2
-rw-r--r--src/proguard/io/ClassFilter.java4
-rw-r--r--src/proguard/io/ClassReader.java4
-rw-r--r--src/proguard/io/ClassRewriter.java2
-rw-r--r--src/proguard/io/DataEntry.java2
-rw-r--r--src/proguard/io/DataEntryClassWriter.java8
-rw-r--r--src/proguard/io/DataEntryCopier.java204
-rw-r--r--src/proguard/io/DataEntryDirectoryFilter.java4
-rw-r--r--src/proguard/io/DataEntryFilter.java2
-rw-r--r--src/proguard/io/DataEntryNameFilter.java2
-rw-r--r--src/proguard/io/DataEntryObfuscator.java4
-rw-r--r--src/proguard/io/DataEntryParentFilter.java2
-rw-r--r--src/proguard/io/DataEntryPump.java2
-rw-r--r--src/proguard/io/DataEntryReader.java2
-rw-r--r--src/proguard/io/DataEntryRenamer.java4
-rw-r--r--src/proguard/io/DataEntryRewriter.java6
-rw-r--r--src/proguard/io/DataEntryWriter.java2
-rw-r--r--src/proguard/io/DirectoryFilter.java8
-rw-r--r--src/proguard/io/DirectoryPump.java2
-rw-r--r--src/proguard/io/DirectoryWriter.java4
-rw-r--r--src/proguard/io/FileDataEntry.java6
-rw-r--r--src/proguard/io/FilteredDataEntryReader.java2
-rw-r--r--src/proguard/io/FilteredDataEntryWriter.java2
-rw-r--r--src/proguard/io/Finisher.java2
-rw-r--r--src/proguard/io/JarReader.java2
-rw-r--r--src/proguard/io/JarWriter.java9
-rw-r--r--src/proguard/io/ManifestRewriter.java4
-rw-r--r--src/proguard/io/NameFilter.java2
-rw-r--r--src/proguard/io/ParentDataEntryWriter.java2
-rw-r--r--src/proguard/io/RenamedDataEntry.java2
-rw-r--r--src/proguard/io/ZipDataEntry.java17
31 files changed, 210 insertions, 110 deletions
diff --git a/src/proguard/io/CascadingDataEntryWriter.java b/src/proguard/io/CascadingDataEntryWriter.java
index 62f3bf7..17c1946 100644
--- a/src/proguard/io/CascadingDataEntryWriter.java
+++ b/src/proguard/io/CascadingDataEntryWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/ClassFilter.java b/src/proguard/io/ClassFilter.java
index aabc5ba..c89f9f6 100644
--- a/src/proguard/io/ClassFilter.java
+++ b/src/proguard/io/ClassFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -23,8 +23,6 @@ package proguard.io;
import proguard.classfile.ClassConstants;
import proguard.util.ExtensionMatcher;
-import java.io.IOException;
-
/**
* This DataEntryReader delegates to one of two other DataEntryReader instances,
diff --git a/src/proguard/io/ClassReader.java b/src/proguard/io/ClassReader.java
index 0ad382b..124160c 100644
--- a/src/proguard/io/ClassReader.java
+++ b/src/proguard/io/ClassReader.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -95,7 +95,7 @@ public class ClassReader implements DataEntryReader
String className = clazz.getName();
if (className != null)
{
- if (!dataEntry.getName().replace(File.pathSeparatorChar, ClassConstants.INTERNAL_PACKAGE_SEPARATOR).equals(className+ClassConstants.CLASS_FILE_EXTENSION) &&
+ if (!dataEntry.getName().replace(File.pathSeparatorChar, ClassConstants.PACKAGE_SEPARATOR).equals(className+ClassConstants.CLASS_FILE_EXTENSION) &&
warningPrinter != null)
{
warningPrinter.print(className,
diff --git a/src/proguard/io/ClassRewriter.java b/src/proguard/io/ClassRewriter.java
index 97e8aef..fab9366 100644
--- a/src/proguard/io/ClassRewriter.java
+++ b/src/proguard/io/ClassRewriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntry.java b/src/proguard/io/DataEntry.java
index 681331b..59946c9 100644
--- a/src/proguard/io/DataEntry.java
+++ b/src/proguard/io/DataEntry.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntryClassWriter.java b/src/proguard/io/DataEntryClassWriter.java
index e9f0327..205cce1 100644
--- a/src/proguard/io/DataEntryClassWriter.java
+++ b/src/proguard/io/DataEntryClassWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,9 +21,9 @@
package proguard.io;
import proguard.classfile.*;
-import proguard.classfile.io.*;
-import proguard.classfile.util.*;
-import proguard.classfile.visitor.*;
+import proguard.classfile.io.ProgramClassWriter;
+import proguard.classfile.util.SimplifiedVisitor;
+import proguard.classfile.visitor.ClassVisitor;
import java.io.*;
diff --git a/src/proguard/io/DataEntryCopier.java b/src/proguard/io/DataEntryCopier.java
index 440e73b..63b2fa9 100644
--- a/src/proguard/io/DataEntryCopier.java
+++ b/src/proguard/io/DataEntryCopier.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -120,19 +120,22 @@ public class DataEntryCopier implements DataEntryReader
String input = args[0];
String output = args[1];
+ boolean outputIsApk = output.endsWith(".apk") ||
+ output.endsWith(".ap_");
boolean outputIsJar = output.endsWith(".jar");
+ boolean outputIsAar = output.endsWith(".aar");
boolean outputIsWar = output.endsWith(".war");
boolean outputIsEar = output.endsWith(".ear");
boolean outputIsZip = output.endsWith(".zip");
DataEntryWriter writer = new DirectoryWriter(new File(output),
+ outputIsApk ||
outputIsJar ||
+ outputIsAar ||
outputIsWar ||
outputIsEar ||
outputIsZip);
- if (!outputIsJar)
- {
// Zip up any zips, if necessary.
DataEntryWriter zipWriter = new JarWriter(writer);
if (outputIsZip)
@@ -150,6 +153,23 @@ public class DataEntryCopier implements DataEntryReader
writer);
}
+ // Zip up any ears, if necessary.
+ DataEntryWriter earWriter = new JarWriter(writer);
+ if (outputIsEar)
+ {
+ // Always zip.
+ writer = earWriter;
+ }
+ else
+ {
+ // Only zip up ears.
+ writer = new FilteredDataEntryWriter(new DataEntryParentFilter(
+ new DataEntryNameFilter(
+ new ExtensionMatcher(".ear"))),
+ earWriter,
+ writer);
+ }
+
// Zip up any wars, if necessary.
DataEntryWriter warWriter = new JarWriter(writer);
if (outputIsWar)
@@ -166,79 +186,163 @@ public class DataEntryCopier implements DataEntryReader
warWriter,
writer);
}
- }
- // Zip up any jars, if necessary.
- DataEntryWriter jarWriter = new JarWriter(writer);
- if (outputIsJar)
- {
- // Always zip.
- writer = jarWriter;
- }
- else
- {
- // Only zip up jars.
- writer = new FilteredDataEntryWriter(new DataEntryParentFilter(
- new DataEntryNameFilter(
- new ExtensionMatcher(".jar"))),
- jarWriter,
- writer);
- }
+ // Zip up any aars, if necessary.
+ DataEntryWriter aarWriter = new JarWriter(writer);
+ if (outputIsAar)
+ {
+ // Always zip.
+ writer = aarWriter;
+ }
+ else
+ {
+ // Only zip up aars.
+ writer = new FilteredDataEntryWriter(new DataEntryParentFilter(
+ new DataEntryNameFilter(
+ new ExtensionMatcher(".aar"))),
+ aarWriter,
+ writer);
+ }
+
+ // Zip up any jars, if necessary.
+ DataEntryWriter jarWriter = new JarWriter(writer);
+ if (outputIsJar)
+ {
+ // Always zip.
+ writer = jarWriter;
+ }
+ else
+ {
+ // Only zip up jars.
+ writer = new FilteredDataEntryWriter(new DataEntryParentFilter(
+ new DataEntryNameFilter(
+ new ExtensionMatcher(".jar"))),
+ jarWriter,
+ writer);
+ }
+
+ // Zip up any apks, if necessary.
+ DataEntryWriter apkWriter = new JarWriter(writer);
+ if (outputIsApk)
+ {
+ // Always zip.
+ writer = apkWriter;
+ }
+ else
+ {
+ // Only zip up apks.
+ writer = new FilteredDataEntryWriter(new DataEntryParentFilter(
+ new DataEntryNameFilter(
+ new ExtensionMatcher(".apk"))),
+ apkWriter,
+ writer);
+ }
// Create the copying DataEntryReader.
DataEntryReader reader = new DataEntryCopier(writer);
-
+ boolean inputIsApk = input.endsWith(".apk") ||
+ input.endsWith(".ap_");
boolean inputIsJar = input.endsWith(".jar");
+ boolean inputIsAar = input.endsWith(".aar");
boolean inputIsWar = input.endsWith(".war");
+ boolean inputIsEar = input.endsWith(".ear");
boolean inputIsZip = input.endsWith(".zip");
- // Unzip any jars, if necessary.
- DataEntryReader jarReader = new JarReader(reader);
- if (inputIsJar)
+ // Unzip any apks, if necessary.
+ DataEntryReader apkReader = new JarReader(reader);
+ if (inputIsApk)
{
// Always unzip.
- reader = jarReader;
+ reader = apkReader;
}
else
{
- // Only unzip jar entries.
+ // Only unzip apk entries.
reader = new FilteredDataEntryReader(new DataEntryNameFilter(
- new ExtensionMatcher(".jar")),
- jarReader,
+ new ExtensionMatcher(".apk")),
+ apkReader,
reader);
- // Unzip any wars, if necessary.
- DataEntryReader warReader = new JarReader(reader);
- if (inputIsWar)
+ // Unzip any jars, if necessary.
+ DataEntryReader jarReader = new JarReader(reader);
+ if (inputIsJar)
{
// Always unzip.
- reader = warReader;
+ reader = jarReader;
}
else
{
- // Only unzip war entries.
+ // Only unzip jar entries.
reader = new FilteredDataEntryReader(new DataEntryNameFilter(
- new ExtensionMatcher(".war")),
- warReader,
+ new ExtensionMatcher(".jar")),
+ jarReader,
reader);
- }
- // Unzip any zips, if necessary.
- DataEntryReader zipReader = new JarReader(reader);
- if (inputIsZip)
- {
- // Always unzip.
- reader = zipReader;
- }
- else
- {
- // Only unzip zip entries.
- reader = new FilteredDataEntryReader(new DataEntryNameFilter(
- new ExtensionMatcher(".zip")),
- zipReader,
- reader);
+ // Unzip any aars, if necessary.
+ DataEntryReader aarReader = new JarReader(reader);
+ if (inputIsAar)
+ {
+ // Always unzip.
+ reader = aarReader;
+ }
+ else
+ {
+ // Only unzip aar entries.
+ reader = new FilteredDataEntryReader(new DataEntryNameFilter(
+ new ExtensionMatcher(".aar")),
+ aarReader,
+ reader);
+
+ // Unzip any wars, if necessary.
+ DataEntryReader warReader = new JarReader(reader);
+ if (inputIsWar)
+ {
+ // Always unzip.
+ reader = warReader;
+ }
+ else
+ {
+ // Only unzip war entries.
+ reader = new FilteredDataEntryReader(new DataEntryNameFilter(
+ new ExtensionMatcher(".war")),
+ warReader,
+ reader);
+
+ // Unzip any ears, if necessary.
+ DataEntryReader earReader = new JarReader(reader);
+ if (inputIsEar)
+ {
+ // Always unzip.
+ reader = earReader;
+ }
+ else
+ {
+ // Only unzip ear entries.
+ reader = new FilteredDataEntryReader(new DataEntryNameFilter(
+ new ExtensionMatcher(".ear")),
+ earReader,
+ reader);
+
+ // Unzip any zips, if necessary.
+ DataEntryReader zipReader = new JarReader(reader);
+ if (inputIsZip)
+ {
+ // Always unzip.
+ reader = zipReader;
+ }
+ else
+ {
+ // Only unzip zip entries.
+ reader = new FilteredDataEntryReader(new DataEntryNameFilter(
+ new ExtensionMatcher(".zip")),
+ zipReader,
+ reader);
+ }
+ }
+ }
+ }
}
}
diff --git a/src/proguard/io/DataEntryDirectoryFilter.java b/src/proguard/io/DataEntryDirectoryFilter.java
index 5bf46bb..a9b2c8b 100644
--- a/src/proguard/io/DataEntryDirectoryFilter.java
+++ b/src/proguard/io/DataEntryDirectoryFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,8 +20,6 @@
*/
package proguard.io;
-import proguard.util.StringMatcher;
-
/**
* This DataEntryFilter filters data entries based on whether they represent
* directories.
diff --git a/src/proguard/io/DataEntryFilter.java b/src/proguard/io/DataEntryFilter.java
index b8b6b20..0b604ba 100644
--- a/src/proguard/io/DataEntryFilter.java
+++ b/src/proguard/io/DataEntryFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntryNameFilter.java b/src/proguard/io/DataEntryNameFilter.java
index 5aebcdd..bc676c0 100644
--- a/src/proguard/io/DataEntryNameFilter.java
+++ b/src/proguard/io/DataEntryNameFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntryObfuscator.java b/src/proguard/io/DataEntryObfuscator.java
index c5742e9..aabb0e8 100644
--- a/src/proguard/io/DataEntryObfuscator.java
+++ b/src/proguard/io/DataEntryObfuscator.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -87,7 +87,7 @@ public class DataEntryObfuscator implements DataEntryReader
String className = dataEntryName.substring(0, suffixIndex);
// Did we get to the package separator?
- if (c == ClassConstants.INTERNAL_PACKAGE_SEPARATOR)
+ if (c == ClassConstants.PACKAGE_SEPARATOR)
{
break;
}
diff --git a/src/proguard/io/DataEntryParentFilter.java b/src/proguard/io/DataEntryParentFilter.java
index 1cc1997..1d4d1e4 100644
--- a/src/proguard/io/DataEntryParentFilter.java
+++ b/src/proguard/io/DataEntryParentFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntryPump.java b/src/proguard/io/DataEntryPump.java
index ddf946b..6cdaef3 100644
--- a/src/proguard/io/DataEntryPump.java
+++ b/src/proguard/io/DataEntryPump.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntryReader.java b/src/proguard/io/DataEntryReader.java
index 39dc82d..d03124a 100644
--- a/src/proguard/io/DataEntryReader.java
+++ b/src/proguard/io/DataEntryReader.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DataEntryRenamer.java b/src/proguard/io/DataEntryRenamer.java
index 99600ae..c8bb319 100644
--- a/src/proguard/io/DataEntryRenamer.java
+++ b/src/proguard/io/DataEntryRenamer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -81,7 +81,7 @@ public class DataEntryRenamer implements DataEntryReader
if (dataEntry.isDirectory() &&
name.length() > 0)
{
- name += ClassConstants.INTERNAL_PACKAGE_SEPARATOR;
+ name += ClassConstants.PACKAGE_SEPARATOR;
}
String newName = (String)nameMap.get(name);
diff --git a/src/proguard/io/DataEntryRewriter.java b/src/proguard/io/DataEntryRewriter.java
index ec07767..666aa0d 100644
--- a/src/proguard/io/DataEntryRewriter.java
+++ b/src/proguard/io/DataEntryRewriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -124,7 +124,7 @@ public class DataEntryRewriter extends DataEntryCopier
// Replace dots by forward slashes.
String className = containsDots ?
- word.replace('.', ClassConstants.INTERNAL_PACKAGE_SEPARATOR) :
+ word.replace('.', ClassConstants.PACKAGE_SEPARATOR) :
word;
// Find the class corrsponding to the word.
@@ -137,7 +137,7 @@ public class DataEntryRewriter extends DataEntryCopier
{
// Replace forward slashes by dots.
newWord = containsDots ?
- newClassName.replace(ClassConstants.INTERNAL_PACKAGE_SEPARATOR, '.') :
+ newClassName.replace(ClassConstants.PACKAGE_SEPARATOR, '.') :
newClassName;
}
}
diff --git a/src/proguard/io/DataEntryWriter.java b/src/proguard/io/DataEntryWriter.java
index 871f823..5dac1e3 100644
--- a/src/proguard/io/DataEntryWriter.java
+++ b/src/proguard/io/DataEntryWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DirectoryFilter.java b/src/proguard/io/DirectoryFilter.java
index 72e2e6d..ebdf4c4 100644
--- a/src/proguard/io/DirectoryFilter.java
+++ b/src/proguard/io/DirectoryFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,12 +20,6 @@
*/
package proguard.io;
-import proguard.classfile.ClassConstants;
-import proguard.util.ExtensionMatcher;
-
-import java.io.IOException;
-
-
/**
* This DataEntryReader delegates to one of two other DataEntryReader instances,
* depending on whether the data entry represents a directory or not.
diff --git a/src/proguard/io/DirectoryPump.java b/src/proguard/io/DirectoryPump.java
index cd6c2ab..fe387ca 100644
--- a/src/proguard/io/DirectoryPump.java
+++ b/src/proguard/io/DirectoryPump.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/DirectoryWriter.java b/src/proguard/io/DirectoryWriter.java
index 7948ee2..e44e195 100644
--- a/src/proguard/io/DirectoryWriter.java
+++ b/src/proguard/io/DirectoryWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -137,7 +137,7 @@ public class DirectoryWriter implements DataEntryWriter
return isFile ?
baseFile :
new File(baseFile,
- dataEntry.getName().replace(ClassConstants.INTERNAL_PACKAGE_SEPARATOR,
+ dataEntry.getName().replace(ClassConstants.PACKAGE_SEPARATOR,
File.separatorChar));
}
diff --git a/src/proguard/io/FileDataEntry.java b/src/proguard/io/FileDataEntry.java
index 618a092..f188f3b 100644
--- a/src/proguard/io/FileDataEntry.java
+++ b/src/proguard/io/FileDataEntry.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -33,7 +33,7 @@ public class FileDataEntry implements DataEntry
{
private final File directory;
private final File file;
- private InputStream inputStream;
+ private InputStream inputStream;
public FileDataEntry(File directory,
@@ -53,7 +53,7 @@ public class FileDataEntry implements DataEntry
file.getName() :
file.getPath()
.substring(directory.getPath().length() + File.separator.length())
- .replace(File.separatorChar, ClassConstants.INTERNAL_PACKAGE_SEPARATOR);
+ .replace(File.separatorChar, ClassConstants.PACKAGE_SEPARATOR);
}
diff --git a/src/proguard/io/FilteredDataEntryReader.java b/src/proguard/io/FilteredDataEntryReader.java
index 03b5dd8..ce0f207 100644
--- a/src/proguard/io/FilteredDataEntryReader.java
+++ b/src/proguard/io/FilteredDataEntryReader.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/FilteredDataEntryWriter.java b/src/proguard/io/FilteredDataEntryWriter.java
index b3b751c..b8d7977 100644
--- a/src/proguard/io/FilteredDataEntryWriter.java
+++ b/src/proguard/io/FilteredDataEntryWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/Finisher.java b/src/proguard/io/Finisher.java
index 7d5f93f..74da6f8 100644
--- a/src/proguard/io/Finisher.java
+++ b/src/proguard/io/Finisher.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/JarReader.java b/src/proguard/io/JarReader.java
index be4c97b..c4b7e3f 100644
--- a/src/proguard/io/JarReader.java
+++ b/src/proguard/io/JarReader.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/JarWriter.java b/src/proguard/io/JarWriter.java
index d85e63b..5437f28 100644
--- a/src/proguard/io/JarWriter.java
+++ b/src/proguard/io/JarWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -27,7 +27,6 @@ import java.util.*;
import java.util.jar.*;
import java.util.zip.*;
-
/**
* This DataEntryWriter sends data entries to a given jar/zip file.
* The manifest and comment properties can optionally be set.
@@ -75,7 +74,7 @@ public class JarWriter implements DataEntryWriter, Finisher
public boolean createDirectory(DataEntry dataEntry) throws IOException
{
- //Make sure we can start with a new entry.
+ // Make sure we can start with a new entry.
if (!prepareEntry(dataEntry))
{
return false;
@@ -85,7 +84,7 @@ public class JarWriter implements DataEntryWriter, Finisher
closeEntry();
// Get the directory entry name.
- String name = dataEntry.getName() + ClassConstants.INTERNAL_PACKAGE_SEPARATOR;
+ String name = dataEntry.getName() + ClassConstants.PACKAGE_SEPARATOR;
// We have to check if the name is already used, because
// ZipOutputStream doesn't handle this case properly (it throws
@@ -182,7 +181,7 @@ public class JarWriter implements DataEntryWriter, Finisher
*/
private boolean prepareEntry(DataEntry dataEntry) throws IOException
{
- // Get the parent stream, new or exisiting.
+ // Get the parent stream, new or existing.
// This may finish our own jar output stream.
OutputStream parentOutputStream =
dataEntryWriter.getOutputStream(dataEntry.getParent(), this);
diff --git a/src/proguard/io/ManifestRewriter.java b/src/proguard/io/ManifestRewriter.java
index 8a8c7ae..f45ad9e 100644
--- a/src/proguard/io/ManifestRewriter.java
+++ b/src/proguard/io/ManifestRewriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,7 +20,7 @@
*/
package proguard.io;
-import proguard.classfile.*;
+import proguard.classfile.ClassPool;
import java.io.*;
diff --git a/src/proguard/io/NameFilter.java b/src/proguard/io/NameFilter.java
index 67d630e..b2e5539 100644
--- a/src/proguard/io/NameFilter.java
+++ b/src/proguard/io/NameFilter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/ParentDataEntryWriter.java b/src/proguard/io/ParentDataEntryWriter.java
index f24ef37..9f97e46 100644
--- a/src/proguard/io/ParentDataEntryWriter.java
+++ b/src/proguard/io/ParentDataEntryWriter.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/RenamedDataEntry.java b/src/proguard/io/RenamedDataEntry.java
index a0f5657..ce97b3f 100644
--- a/src/proguard/io/RenamedDataEntry.java
+++ b/src/proguard/io/RenamedDataEntry.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/io/ZipDataEntry.java b/src/proguard/io/ZipDataEntry.java
index 20a9d3b..84e24db 100644
--- a/src/proguard/io/ZipDataEntry.java
+++ b/src/proguard/io/ZipDataEntry.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2014 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -35,6 +35,7 @@ public class ZipDataEntry implements DataEntry
private final DataEntry parent;
private final ZipEntry zipEntry;
private ZipInputStream zipInputStream;
+ private InputStream bufferedInputStream;
public ZipDataEntry(DataEntry parent,
@@ -53,12 +54,12 @@ public class ZipDataEntry implements DataEntry
{
// Get the right separators.
String name = zipEntry.getName()
- .replace(File.separatorChar, ClassConstants.INTERNAL_PACKAGE_SEPARATOR);
+ .replace(File.separatorChar, ClassConstants.PACKAGE_SEPARATOR);
// Chop the trailing directory slash, if any.
int length = name.length();
return length > 0 &&
- name.charAt(length-1) == ClassConstants.INTERNAL_PACKAGE_SEPARATOR ?
+ name.charAt(length-1) == ClassConstants.PACKAGE_SEPARATOR ?
name.substring(0, length -1) :
name;
}
@@ -72,14 +73,20 @@ public class ZipDataEntry implements DataEntry
public InputStream getInputStream() throws IOException
{
- return zipInputStream;
+ if (bufferedInputStream == null)
+ {
+ bufferedInputStream = new BufferedInputStream(zipInputStream);
+ }
+
+ return bufferedInputStream;
}
public void closeInputStream() throws IOException
{
zipInputStream.closeEntry();
- zipInputStream = null;
+ zipInputStream = null;
+ bufferedInputStream = null;
}