Java · Installation

Installation

6.0.0-rc.1 · 91a27bdd

<dependency>
  <groupId>com.github.ashvardanian</groupId>
  <artifactId>stringzilla</artifactId>
  <version>5.1.1</version>
</dependency>

The bindings require JDK 22+ and native access enabled at launch.

java --enable-native-access=ALL-UNNAMED ...
import com.stringzilla.StringZilla;
import static java.nio.charset.StandardCharsets.UTF_8;

byte[] text = "the quick brown fox".getBytes(UTF_8);
long position = StringZilla.indexOf(text, "brown".getBytes(UTF_8)); // first match, as a UTF-8 byte offset
long digest = StringZilla.hash(text);                               // fast 64-bit AES hash

All offsets are UTF-8 byte offsets, not UTF-16 char indices. Value operations (hash, equal, compare) read on-heap byte[] in place via critical downcalls, while large off-heap buffers (memory-mapped files, columnar data) are fully zero-copy via MemorySegment. Buffer-filling operations write into caller-provided arrays and return a count, so steady-state usage allocates nothing.