Ollama4j
A Java library (wrapper/binding) for Ollama server.
Loading...
Searching...
No Matches
OllamaResultStream.java
Go to the documentation of this file.
1
/*
2
* Ollama4j - Java library for interacting with Ollama server.
3
* Copyright (c) 2025 Amith Koujalgi and contributors.
4
*
5
* Licensed under the MIT License (the "License");
6
* you may not use this file except in compliance with the License.
7
*
8
*/
9
package
io.github.ollama4j.models.response;
10
11
import
java.util.Iterator;
12
import
java.util.LinkedList;
13
import
java.util.Queue;
14
15
public
class
OllamaResultStream
extends
LinkedList<String> implements Queue<String> {
16
@Override
17
public
String
poll
() {
18
StringBuilder tokens =
new
StringBuilder();
19
Iterator<String> iterator = this.listIterator();
20
while
(iterator.hasNext()) {
21
tokens.append(iterator.next());
22
iterator.remove();
23
}
24
return
tokens.toString();
25
}
26
}
io.github.ollama4j.models.response.OllamaResultStream
Definition
OllamaResultStream.java:15
io.github.ollama4j.models.response.OllamaResultStream.poll
String poll()
Definition
OllamaResultStream.java:17
src
main
java
io
github
ollama4j
models
response
OllamaResultStream.java
Generated by
1.12.0