Stdlib index
- Captured-borrow migration worklist (3.3.3)
- Owned-bind migration worklist (8.2.7)
- Return-side title audit — the ride-through enumeration
- stdlib ownership audit
- stdlib ownership dispositions (plan 1.3.1 / 4.3.1)
aot
codec
codec / csv
codec / json
collection
- ArrayList
- BPlusTree
- Cache
- Collectors
- HashMap
- HashSet
- Heap
- ImmutableList
- ImmutableMap
- ImmutableSet
- LinkedList
- RedBlackTree
- Sort
collection / ltm
concurrent
error
- Exception
- NoOptionalValueException
- NotProvidedException
- RecoverableException
- ScopedBuildFailedException
- ScopeNotActiveException
- Throwable
- UnrecoverableException
gfx
hash
ifx
io
io / file
io / net
io / net / dns
io / net / uri
lang
lang / stream
math
math / fft
math / linalg
math / npio
math / poly
math / random
math / stats
nucleo
- Columns — the Arrow-laid-out substrate
- Fused tensor expressions — Fuse
- Table — the lazy, typed dataframe
- Tape — define-by-run autograd
- Transform intrinsics — Grad, Vmap, Jit
process
reflect
search / distance
search / fuzzy
search / ngram
session
time
- Clock
- DateTimeFormatter
- Duration
- Instant
- LocalDate
- LocalDateTime
- LocalTime
- Period
- ZonedDateTime
- ZoneId
- ZoneOffset
wire
xpu
xpu / mesh
CompressStream
cajeta.wire.CompressStream is an open compression, made by
Compressor.stream(level). Bytes written are compressed as
they arrive. flush hands out everything needed to decode what was written so
far, which is what a streamed HTTP body sends as each piece. finish ends the
stream with the format’s trailer.
import cajeta.wire.CompressStream;
// Holds what is written and hands it back unchanged.
public final class CopyStream implements CompressStream {
int8[] held;
int64 n;
public CopyStream() {
this.held = heap int8[4096];
this.n = 0;
}
public void write(int8[] src, int64 len) {
int64 i = 0;
while (i < len) {
this.held[this.n + i] = src[i];
i = i + 1;
}
this.n = this.n + len;
}
public #int8[] flush() {
int8[] out = heap int8[this.n];
int64 i = 0;
while (i < this.n) {
out[i] = this.held[i];
i = i + 1;
}
this.n = 0;
return #out;
}
public #int8[] finish() {
return this.flush();
}
}
Methods
| Signature | |
|---|---|
void write(int8[] src, int64 len) ⚑ | Compress src[0 .. len). Output is held until flush or finish |
#int8[] flush() ⚑ | The compressed bytes since the last call, ending where everything written so far decodes. May be empty |
#int8[] finish() ⚑ | The remaining bytes and the trailer. The stream takes no more writes |
⚑ = @EntryPoint