Object javaObj = value.toJavaObject();
if (javaObj instanceof BinaryInput)
return (BinaryInput) javaObj;
else if (javaObj instanceof InputStream)
return new ReadStreamInput(env, (InputStream) javaObj);
else
return new ReadStreamInput(env, value.toInputStream());
}