guava 19
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 27 Jul 2016 07:44:57 +0000 (09:44 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 27 Jul 2016 08:52:48 +0000 (10:52 +0200)
tools/launcher-generator/src/com/pme/launcher/LauncherGenerator.java

index 673bc5afc2c1bb58e0552a231e67822b61e8b99b..96f355eba66db93b3873191b8fd89b6ab8c92278 100644 (file)
@@ -135,12 +135,13 @@ public class LauncherGenerator {
 
   public void injectIcon(int id, final InputStream iconStream) throws IOException {
     File f = File.createTempFile("launcher", "ico");
-    Files.copy(new InputSupplier<InputStream>() {
-      @Override
-      public InputStream getInput() throws IOException {
-        return iconStream;
-      }
-    }, f);
+
+    try {
+      Files.asByteSink(f).writeFrom(iconStream);
+    }
+    finally {
+      iconStream.close();
+    }
     IconResourceInjector iconInjector = new IconResourceInjector();
     iconInjector.injectIcon(f, myRoot, "IRD" + id);
   }