Invoke a function with the given name and input. @param functionName The name of the exported function to invoke @param inputData The raw bytes representing any input data @return A byte array representing the raw output data @throws ExtismException if the call fails
(String functionName, byte[] inputData)
| 113 | * @throws ExtismException if the call fails |
| 114 | */ |
| 115 | public byte[] call(String functionName, byte[] inputData) { |
| 116 | |
| 117 | Objects.requireNonNull(functionName, "functionName"); |
| 118 | |
| 119 | int inputDataLength = inputData == null ? 0 : inputData.length; |
| 120 | int exitCode = LibExtism.INSTANCE.extism_plugin_call(this.pluginPointer, functionName, inputData, inputDataLength); |
| 121 | if (exitCode != 0) { |
| 122 | String error = this.error(); |
| 123 | throw new ExtismException(error); |
| 124 | } |
| 125 | |
| 126 | int length = LibExtism.INSTANCE.extism_plugin_output_length(this.pluginPointer); |
| 127 | Pointer output = LibExtism.INSTANCE.extism_plugin_output_data(this.pluginPointer); |
| 128 | return output.getByteArray(0, length); |
| 129 | } |
| 130 | |
| 131 | |
| 132 | /** |