MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / executeRuby

Method executeRuby

src/main/java/core/packetproxy/common/Utils.java:195–207  ·  view source on GitHub ↗

EXEを実行する。MACの場合はmonoで実行する @return 標準出力に表示されたデータ

(String... command)

Source from the content-addressed store, hash-verified

193 * @return 標準出力に表示されたデータ
194 */
195 public static byte[] executeRuby(String... command) throws Exception {
196
197 Process p = Runtime.getRuntime().exec(addRubyPath(command));
198 InputStream in = p.getInputStream();
199 ByteArrayOutputStream bout = new ByteArrayOutputStream();
200 byte[] buffer = new byte[4096];
201 int len = 0;
202 while ((len = in.read(buffer, 0, 4096)) > 0) {
203
204 bout.write(buffer, 0, len);
205 }
206 return Base64.decodeBase64(bout.toByteArray());
207 }
208
209 public static byte[] readfile(String filename) throws Exception {
210 FileInputStream fis = new FileInputStream(filename);

Callers

nothing calls this directly

Calls 6

addRubyPathMethod · 0.95
decodeBase64Method · 0.80
getInputStreamMethod · 0.65
writeMethod · 0.65
readMethod · 0.45
toByteArrayMethod · 0.45

Tested by

no test coverage detected