final Location loc = be.location();
final ThreadReference tr = be.thread();
if (loc.equals(interceptIn)) {
LocalVariable result = (LocalVariable) loc.method().variablesByName("result").get(0);
LocalVariable buffer = (LocalVariable) loc.method().arguments().get(0);
ArrayReference buf = (ArrayReference) tr.frame(0).getValue(buffer);
new InputInterceptHandler(tr, buf, result).start();
} else if (loc.equals(interceptOut)) {
LocalVariable result = (LocalVariable) loc.method().variablesByName("result").get(0);
LocalVariable data = (LocalVariable) loc.method().arguments().get(0);
ArrayReference buf = (ArrayReference) tr.frame(0).getValue(data);
List values = buf.getValues();
byte[] temp = new byte[buf.length()];
for (int i = 0; i < temp.length; i++) {
temp[i] = ((ByteValue)values.get(i)).byteValue();
}
pipedOut.write(temp);
pipedOut.flush();