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
FileWriter
cajeta.io.file.FileWriter — streaming byte writer, returned by
File.openWrite(path, mode). The caller hands in (data, len) per
call; the native write loops past OS-level short writes so every byte lands,
but there is no user-space buffer — bytes go straight to the syscall. Write
String payloads with writeString, raw bytes with write. Call close()
when done.
FileWriter w #= File.openWrite("/tmp/out.txt", OpenMode.APPEND);
w.writeString("first line\n");
int8[] bytes = heap int8[2];
w.write(bytes, 2);
w.flush();
w.close();
Methods
| Signature | |
|---|---|
void write(int8[] data, int32 len) ⚑ | Write data[0..len) to the file; tolerates partial OS writes internally |
void writeString(String s) ⚑ | Write a String’s UTF-8 bytes to the file |
void flush() | Currently a no-op (writes are unbuffered); does not fsync — durability is File.sync() |
void close() | Flush + close the underlying fd; idempotent |
⚑ = @EntryPoint
See also
- Tour: FileIoDemo
- Source:
runtime/src/cajeta/io/file/FileWriter.cajeta - File — the factory (
openWrite); FileReader — the reading twin