Skip to content

Commit 68bc1dd

Browse files
dfa1claude
andcommitted
docs: reference the official zstd API manual
Verified the streaming impl against https://facebook.github.io/zstd/doc/api_manual_latest.html (cParameter/ EndDirective values, compressStream2/decompressStream return semantics, buffer struct layout — all match). Name the e_flush directive and link the manual from Bindings and compatibility.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eecc180 commit 68bc1dd

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

docs/compatibility.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Symbol compatibility
22

3-
Coverage of the zstd C API by the `io.github.dfa1.zstdffm` bindings.
3+
Coverage of the zstd C API by the `io.github.dfa1.zstdffm` bindings. Signatures
4+
and semantics follow the [official manual](https://facebook.github.io/zstd/doc/api_manual_latest.html).
45

56
- zstd version: **1.6.0** (vendored `third_party/zstd`)
67
- Public symbols exported by `libzstd`: **186**

zstd/src/main/java/io/github/dfa1/zstdffm/Bindings.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
/// Central registry of bound zstd C functions.
1111
///
12+
/// Signatures and semantics follow the
13+
/// [official manual](https://facebook.github.io/zstd/doc/api_manual_latest.html).
14+
///
1215
/// `size_t` and `unsigned long long` are modelled as
1316
/// {@link java.lang.foreign.ValueLayout#JAVA_LONG} (LP64); the public API guards
1417
/// against negative interpretations where zstd uses sentinel values.

zstd/src/main/java/io/github/dfa1/zstdffm/ZstdOutputStream.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
/// }
2525
public final class ZstdOutputStream extends OutputStream {
2626

27-
// ZSTD_cParameter / ZSTD_EndDirective values from zstd.h
27+
// ZSTD_cParameter / ZSTD_EndDirective values from zstd.h — see
28+
// https://facebook.github.io/zstd/doc/api_manual_latest.html
2829
private static final int ZSTD_C_COMPRESSION_LEVEL = 100;
2930
private static final int ZSTD_E_CONTINUE = 0;
31+
private static final int ZSTD_E_FLUSH = 1;
3032
private static final int ZSTD_E_END = 2;
3133

3234
private final OutputStream out;
@@ -101,7 +103,7 @@ public void flush() throws IOException {
101103
in.set(inSeg, 0, 0);
102104
long remainingHint;
103105
do {
104-
remainingHint = drainOutput(1 /* ZSTD_e_flush */);
106+
remainingHint = drainOutput(ZSTD_E_FLUSH);
105107
} while (remainingHint != 0);
106108
out.flush();
107109
}

0 commit comments

Comments
 (0)