from Bytes
Rebuilds a Document from a byte envelope produced by toBytes. The envelope carries at least four blobs (snapshot, checkpoint, changeID, pending changes); a missing epoch blob decodes as 0 and a missing docId blob decodes as "", so a legacy four- or five-blob envelope still decodes. Blobs beyond the sixth are ignored rather than rejected, so an app downgrade cannot discard un-pushed edits carried in an envelope written by a newer SDK.
Any decode failure — framing/checkpoint/epoch corruption, OR a protobuf-level failure inside the snapshot, changeID, or pending-changes blobs (shared with the JS SDK's JSON.parse/protobuf errors and iOS's decode errors) — surfaces as YorkieException with ErrInvalidArgument; where a lower-level exception caused it, that exception is attached as Throwable.cause (a blob that merely fails validation, such as a non-numeric epoch, has no cause). The half-built Document is closed first so it cannot leak its dispatcher (spec 029 I5/M1).