JsonLinesAnimationOutput

Writes an animation trace in the JSON Lines (.atf) format: an AnimationTraceHeader on the first line, then one AnimationEvent per line. Each line is independently valid JSON, so the file is streamable and inspectable with standard tools (a text editor, jq, Python).

The writer is renderer- and engine-agnostic: it targets any Writer, which is why it can be unit-tested against an in-memory StringWriter and used in production against a file via toFile. It is Closeable; wrap it in use { } or call close to flush and release the underlying writer.

Usage is "header first, then events": writeHeader must be called exactly once before any write.

Constructors

Link copied to clipboard
constructor(writer: Writer)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun flush()

Flushes buffered bytes to the underlying destination without closing it.

Link copied to clipboard
fun write(event: AnimationEvent)

Appends one event as a single JSON line. Requires writeHeader to have been called.

Link copied to clipboard

Appends every event in events, in order.

Link copied to clipboard

Writes the trace header as the first line. Must be called exactly once, before any write.