Ver código fonte

Stop using StreamUtils methods.

pull/160/head
Greg Holmes 9 anos atrás
pai
commit
8bbdee4471

+ 1
- 2
freedesktop_notifications/src/com/dmdirc/addons/freedesktop_notifications/FDManager.java Ver arquivo

@@ -109,9 +109,8 @@ public class FDManager implements ConfigChangeListener {
109 109
 
110 110
         try {
111 111
             final Process myProcess = Runtime.getRuntime().exec(args);
112
-            final StringBuffer data = new StringBuffer();
113 112
             StreamUtils.readStream(myProcess.getErrorStream());
114
-            StreamUtils.readStreamIntoStringBuffer(myProcess.getInputStream(), data);
113
+            StreamUtils.readStream(myProcess.getInputStream());
115 114
             try {
116 115
                 myProcess.waitFor();
117 116
             } catch (InterruptedException e) {

+ 6
- 3
mediasource_windows/src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java Ver arquivo

@@ -29,7 +29,10 @@ import com.dmdirc.plugins.implementations.BasePlugin;
29 29
 import com.dmdirc.plugins.implementations.PluginFilesHelper;
30 30
 import com.dmdirc.util.io.StreamUtils;
31 31
 
32
+import com.google.common.io.CharStreams;
33
+
32 34
 import java.io.IOException;
35
+import java.io.InputStreamReader;
33 36
 import java.util.ArrayList;
34 37
 import java.util.List;
35 38
 
@@ -75,15 +78,15 @@ public class WindowsMediaSourcePlugin extends BasePlugin
75 78
                 filesHelper.getFilesDirString() + "GetMediaInfo.exe",
76 79
                 player,
77 80
                 method});
78
-            final StringBuffer data = new StringBuffer();
79 81
             StreamUtils.readStream(myProcess.getErrorStream());
80
-            StreamUtils.readStreamIntoStringBuffer(myProcess.getInputStream(), data);
82
+            final String data = CharStreams.toString(new InputStreamReader(
83
+                    myProcess.getInputStream()));
81 84
             try {
82 85
                 myProcess.waitFor();
83 86
             } catch (InterruptedException e) {
84 87
             }
85 88
 
86
-            return new MediaInfoOutput(myProcess.exitValue(), data.toString());
89
+            return new MediaInfoOutput(myProcess.exitValue(), data);
87 90
         } catch (SecurityException | IOException e) {
88 91
         }
89 92
 

Carregando…
Cancelar
Salvar