From a31171c5757addb54a140101c5cfd669dc888e7a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 12 Jul 2009 21:36:25 +0000 Subject: [PATCH] Out with commons-io. --- etc/getdown.pro | 1 - libs-incl.xml | 1 - src/java/com/threerings/getdown/data/Application.java | 9 ++++++--- src/java/com/threerings/getdown/tools/Differ.java | 3 +-- src/java/com/threerings/getdown/tools/Patcher.java | 3 +-- src/java/com/threerings/getdown/util/FileUtil.java | 4 +--- src/java/com/threerings/getdown/util/LaunchUtil.java | 7 +++---- 7 files changed, 12 insertions(+), 16 deletions(-) diff --git a/etc/getdown.pro b/etc/getdown.pro index 62f2421..3d75224 100644 --- a/etc/getdown.pro +++ b/etc/getdown.pro @@ -11,7 +11,6 @@ -injars dist/lib/samskivert.jar( com/samskivert/Log.class,**/io/**,**/swing/**,**/net/**,**/text/**,**/util/**) -injars dist/lib/commons-codec.jar(!META-INF/*) --injars dist/lib/commons-io.jar(!META-INF/*) -injars dist/lib/snark.jar(!META-INF/*) -dontskipnonpubliclibraryclasses diff --git a/libs-incl.xml b/libs-incl.xml index a42b81a..c6dfcc6 100644 --- a/libs-incl.xml +++ b/libs-incl.xml @@ -4,7 +4,6 @@ - diff --git a/src/java/com/threerings/getdown/data/Application.java b/src/java/com/threerings/getdown/data/Application.java index bd595fe..b7adc8b 100644 --- a/src/java/com/threerings/getdown/data/Application.java +++ b/src/java/com/threerings/getdown/data/Application.java @@ -23,6 +23,10 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.threerings.getdown.data; +import java.io.FileInputStream; + +import com.samskivert.io.StreamUtil; + import static com.threerings.getdown.Log.log; import java.awt.Color; @@ -63,7 +67,6 @@ import java.util.regex.Pattern; import javax.swing.JApplet; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.IOUtils; import com.samskivert.io.StreamUtil; import com.samskivert.text.MessageUtil; @@ -1182,7 +1185,7 @@ public class Application FileReader reader = null; try { reader = new FileReader(signatureFile); - signature = IOUtils.toByteArray(reader, "utf8"); + signature = StreamUtil.toByteArray(new FileInputStream(signatureFile)); } finally { StreamUtil.close(reader); signatureFile.delete(); // delete the file regardless @@ -1267,7 +1270,7 @@ public class Application try { fin = targetURL.openStream(); fout = new FileOutputStream(target); - IOUtils.copy(fin, fout); + StreamUtil.copy(fin, fout); } finally { StreamUtil.close(fin); StreamUtil.close(fout); diff --git a/src/java/com/threerings/getdown/tools/Differ.java b/src/java/com/threerings/getdown/tools/Differ.java index 9aefbb9..db54943 100644 --- a/src/java/com/threerings/getdown/tools/Differ.java +++ b/src/java/com/threerings/getdown/tools/Differ.java @@ -40,7 +40,6 @@ import java.util.zip.ZipEntry; import java.security.MessageDigest; import com.sun.javaws.jardiff.JarDiff; -import org.apache.commons.io.IOUtils; import com.samskivert.io.StreamUtil; @@ -243,7 +242,7 @@ public class Differ { FileInputStream fin = null; try { - IOUtils.copy(fin = new FileInputStream(file), jout); + StreamUtil.copy(fin = new FileInputStream(file), jout); } finally { StreamUtil.close(fin); } diff --git a/src/java/com/threerings/getdown/tools/Patcher.java b/src/java/com/threerings/getdown/tools/Patcher.java index b74c3e6..d301f43 100644 --- a/src/java/com/threerings/getdown/tools/Patcher.java +++ b/src/java/com/threerings/getdown/tools/Patcher.java @@ -33,7 +33,6 @@ import java.util.jar.JarFile; import java.util.zip.ZipEntry; import com.samskivert.io.StreamUtil; -import org.apache.commons.io.IOUtils; import com.threerings.getdown.util.FileUtil; import com.threerings.getdown.util.ProgressObserver; @@ -166,7 +165,7 @@ public class Patcher InputStream in = null; FileOutputStream fout = null; try { - IOUtils.copy(in = file.getInputStream(entry), fout = new FileOutputStream(patch)); + StreamUtil.copy(in = file.getInputStream(entry), fout = new FileOutputStream(patch)); StreamUtil.close(fout); fout = null; diff --git a/src/java/com/threerings/getdown/util/FileUtil.java b/src/java/com/threerings/getdown/util/FileUtil.java index 995203e..f59db54 100644 --- a/src/java/com/threerings/getdown/util/FileUtil.java +++ b/src/java/com/threerings/getdown/util/FileUtil.java @@ -30,8 +30,6 @@ import java.io.IOException; import com.samskivert.io.StreamUtil; -import org.apache.commons.io.IOUtils; - import static com.threerings.getdown.Log.log; /** @@ -78,7 +76,7 @@ public class FileUtil try { fin = new FileInputStream(source); fout = new FileOutputStream(dest); - IOUtils.copy(fin, fout); + StreamUtil.copy(fin, fout); if (!source.delete()) { log.warning("Failed to delete " + source + " after brute force copy to " + dest + "."); diff --git a/src/java/com/threerings/getdown/util/LaunchUtil.java b/src/java/com/threerings/getdown/util/LaunchUtil.java index 5027514..455c205 100644 --- a/src/java/com/threerings/getdown/util/LaunchUtil.java +++ b/src/java/com/threerings/getdown/util/LaunchUtil.java @@ -30,8 +30,7 @@ import java.io.IOException; import java.io.PrintStream; import java.util.logging.Level; -import org.apache.commons.io.IOUtils; - +import com.samskivert.io.StreamUtil; import com.samskivert.util.RunAnywhere; import com.samskivert.util.StringUtil; @@ -176,7 +175,7 @@ public class LaunchUtil try { // copy the moved file back to getdown-dop-new.jar so that we don't end up // downloading another copy next time - IOUtils.copy(new FileInputStream(curgd), new FileOutputStream(newgd)); + StreamUtil.copy(new FileInputStream(curgd), new FileOutputStream(newgd)); } catch (IOException e) { log.warning("Error copying updated Getdown back: " + e); } @@ -193,7 +192,7 @@ public class LaunchUtil // that didn't work, let's try copying it log.info("Attempting to upgrade by copying over " + curgd + "..."); try { - IOUtils.copy(new FileInputStream(newgd), new FileOutputStream(curgd)); + StreamUtil.copy(new FileInputStream(newgd), new FileOutputStream(curgd)); } catch (IOException ioe) { log.warning("Mayday! Brute force copy method also failed.", ioe); }