MCPcopy Index your code
hub / github.com/extism/java-sdk / call

Method call

src/main/java/org/extism/sdk/Plugin.java:115–129  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 /**

Calls 4

errorMethod · 0.95
extism_plugin_callMethod · 0.80