Я читаю данные из потока процесса. По сути, я запускаю процесс с помощью API Runtime.exec и получаю входной поток процесса.
Runtime rt = Runtime.getRuntime();
process = rt.exec("C:/cygwin/home/grec.exe");
InputStream is = process.getInputStream();
Затем я собираю выходные данные процесса как --
BufferedReader in = new BufferedReader(is);
char[] ls = new char[s.available()];
ls.read(ls);
String output = new String(ls);
Однако, когда я печатаю вывод строки, я получаю --
break [loc] Add a breakpoint at [file:]line or template
callflow [val] Enable call flow tracing
next Execute the over instruction, stepping over calls
over Execute the current instruction hierarchy
Но фактический результат -
break [loc] Add a breakpoint at [file:]line or template
callflow [val] Enable call flow tracing
next Execute the over instruction, stepping over calls
over Execute the current instruction hierarchy
print <xpath> Print the value of an XPath expression
profile [val] Turn profiler on or off
reload Reload the script contents
run Restart the script
step Execute the next instruction, stepping into calls
verbose Turn on verbose (-v) output logging
where Show the backtrace of template calls
quit Quit debugger
То есть часть вывода усекается, но код не выдает никаких исключений. Я попытался увеличить размер BufferedReader, а также увеличить размер массива ls. Я не могу найти причину такого поведения. Любые подсказки или указатели на то, что может быть причиной этого, будут высоко оценены.
s
в вашем примере кода? И может я что-то проглядел, но как насчетOutputStream out = process.getOutputStream(); BufferedReader bufferedOut = new BufferedReader(out);
- person bpgergo   schedule 16.01.2012in.readline()
? Почему вы создаете массив символов? - person artbristol   schedule 16.01.2012