Frame input = pullInput("data");
ByteBuffer data;
if (input.getFormat().getObjectClass() == String.class) {
String stringVal = (String)input.getObjectValue();
data = ByteBuffer.wrap(stringVal.getBytes());
} else {
data = input.getData();
}
try {
mOutputStream.write(data.array(), 0, data.limit());
mOutputStream.flush();
} catch (IOException exception) {
throw new RuntimeException(
"OutputStreamTarget: Could not write to stream: " + exception.getMessage() + "!");
}