有没有熟悉java的runtime的么?通过调用Runtime.getRuntime().exec(cmds)方法使用linux的tail命令去拿回的inputstream流的长度是有限制的么? 为什么我每次它只能最大给我传回来64k。。
String cmd = null;
if (logLineCount > 0) {
cmd = "tail -n " + logLineCount + " " + filePath;
} else {
cmd = "cat " + filePath;
}
String[] cmds = new String[] {"/bin/sh", "-c", cmd};
Process process = null;
process = Runtime.getRuntime().exec(cmds);
logger.debug("process: " + process.toString());
if (process != null) {
InputStream in = process.getInputStream();
int size = in.available();
byte[] buffer = new byte[size];
in.read(buffer);
in.close();
result = new String(buffer, "UTF-8");
}