Add underpinnings to allow for local plaintext export.

Co-authored-by: Cody Henthorne <cody@signal.org>
This commit is contained in:
Alex Hart
2026-03-25 16:44:26 -03:00
committed by Cody Henthorne
parent b605148ac4
commit f2e4881026
15 changed files with 859 additions and 42 deletions

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2024 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.signal.archive.stream
import org.signal.archive.proto.BackupInfo
import org.signal.archive.proto.Frame
import org.signal.core.util.toJson
import java.io.IOException
import java.io.OutputStream
/**
* Writes backup frames to the wrapped stream as newline-delimited JSON (JSONL).
*/
class JsonBackupWriter(private val outputStream: OutputStream) : BackupExportWriter {
@Throws(IOException::class)
override fun write(header: BackupInfo) {
outputStream.write((header.toJson() + "\n").toByteArray())
}
@Throws(IOException::class)
override fun write(frame: Frame) {
outputStream.write((frame.toJson() + "\n").toByteArray())
}
override fun close() {
outputStream.close()
}
}