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
Decompressor
cajeta.wire.Decompressor is the decompress stage of a byte-to-byte codec, the
inverse of Compressor. A block container knows each block’s
decompressed length and passes it as expandedLen. A transport that does not,
such as HTTP content coding, passes a cap instead, and the codec raises
DecompressionLimitException rather than
produce more.
import cajeta.wire.Decompressor;
import cajeta.wire.DecompressionLimitException;
// A pass-through codec showing the contract's shape.
public final class CopyDecompressor implements Decompressor {
public CopyDecompressor() { }
static #int8[] take(int8[] src, int64 len) {
int8[] out = heap int8[len];
int64 i = 0;
while (i < len) {
out[i] = src[i];
i = i + 1;
}
return #out;
}
public #int8[] decompress(int8[] src, int64 expandedLen) {
return CopyDecompressor.take(src, expandedLen);
}
public #int8[] decompress(int8[] src, int64 len, int64 maxOut) {
if (len > maxOut) {
throw heap DecompressionLimitException("output over the cap", maxOut);
}
return CopyDecompressor.take(src, len);
}
}
Methods
| Signature | |
|---|---|
#int8[] decompress(int8[] src, int64 expandedLen) ⚑ | Decompress src into a fresh, caller-owned buffer of exactly expandedLen bytes |
#int8[] decompress(int8[] src, int64 len, int64 maxOut) ⚑ | Decompress src[0 .. len), whose output size is unknown. Raises DecompressionLimitException rather than exceed maxOut bytes |
⚑ = @EntryPoint
See also
- Compressor, the inverse stage
- DecompressionLimitException
- Source:
runtime/src/cajeta/wire/Decompressor.cajeta