Bläddra i källkod

Stop using StreamUtils methods.

pull/159/head
Greg Holmes 9 år sedan
förälder
incheckning
9d7888a322

+ 4
- 6
dcc/src/com/dmdirc/addons/dcc/kde/KDialogProcess.java Visa fil

@@ -22,11 +22,11 @@
22 22
 
23 23
 package com.dmdirc.addons.dcc.kde;
24 24
 
25
-import com.dmdirc.util.io.StreamUtils;
25
+import com.google.common.io.CharStreams;
26 26
 
27 27
 import java.io.File;
28 28
 import java.io.IOException;
29
-import java.util.ArrayList;
29
+import java.io.InputStreamReader;
30 30
 import java.util.List;
31 31
 
32 32
 /**
@@ -57,10 +57,8 @@ public class KDialogProcess {
57 57
         System.arraycopy(params, 0, exec, 1, params.length);
58 58
         exec[0] = IS_BIN ? "/bin/kdialog" : "/usr/bin/kdialog";
59 59
         process = Runtime.getRuntime().exec(exec);
60
-        stdOutput = new ArrayList<>();
61
-        stdError = new ArrayList<>();
62
-        StreamUtils.readStreamIntoList(process.getInputStream(), stdOutput);
63
-        StreamUtils.readStreamIntoList(process.getErrorStream(), stdError);
60
+        stdOutput = CharStreams.readLines(new InputStreamReader(process.getInputStream()));
61
+        stdError = CharStreams.readLines(new InputStreamReader(process.getErrorStream()));
64 62
     }
65 63
 
66 64
     /**

+ 7
- 5
exec/src/com/dmdirc/addons/exec/ExecCommand.java Visa fil

@@ -35,9 +35,11 @@ import com.dmdirc.logger.ErrorLevel;
35 35
 import com.dmdirc.util.CommandUtils;
36 36
 import com.dmdirc.util.io.StreamUtils;
37 37
 
38
+import com.google.common.io.CharStreams;
39
+
38 40
 import java.io.File;
39 41
 import java.io.IOException;
40
-import java.util.LinkedList;
42
+import java.io.InputStreamReader;
41 43
 import java.util.List;
42 44
 
43 45
 import javax.annotation.Nonnull;
@@ -88,10 +90,10 @@ public class ExecCommand extends Command {
88 90
                     StreamUtils.readStream(p.getInputStream());
89 91
                     StreamUtils.readStream(p.getErrorStream());
90 92
                 } else {
91
-                    final List<String> execOutput = new LinkedList<>();
92
-                    final List<String> errorOutput = new LinkedList<>();
93
-                    StreamUtils.readStreamIntoList(p.getInputStream(), execOutput);
94
-                    StreamUtils.readStreamIntoList(p.getErrorStream(), errorOutput);
93
+                    final List<String> execOutput = CharStreams.readLines(
94
+                            new InputStreamReader(p.getInputStream()));
95
+                    final List<String> errorOutput = CharStreams.readLines(
96
+                            new InputStreamReader(p.getErrorStream()));
95 97
                     for (String line : execOutput) {
96 98
                         sendLine(origin, args.isSilent(), FORMAT_OUTPUT, line);
97 99
                     }

Laddar…
Avbryt
Spara