summaryrefslogtreecommitdiffstats
path: root/hosted-api
diff options
context:
space:
mode:
Diffstat (limited to 'hosted-api')
-rw-r--r--hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java b/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java
index 7ed86210957..6b2f5596fd6 100644
--- a/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java
+++ b/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java
@@ -56,6 +56,14 @@ public class MultiPartStreamer {
return this;
}
+ /** Adds the given data as a named part in this, using the {@code "application/octet-stream" content type}. */
+ public MultiPartStreamer addBytes(String name, byte[] data) {
+ streams.add(() -> separator(name, "application/octet-stream"));
+ streams.add(() -> new ByteArrayInputStream(data));
+
+ return this;
+ }
+
/** Adds the contents of the file at the given path as a named part in this. */
public MultiPartStreamer addFile(String name, Path path) {
streams.add(() -> separator(name, path));