Enumeration Context

The context for encoding a PCollection element. For example, for strings of utf8 characters or bytes, wholeStream encoding means that the string will be encoded as-is; while needsDelimiter encoding means that the string will be encoded prefixed with its length.

coder = new StrUtf8Coder()
w1 = new Writer()
coder.encode("my string", w, Context.wholeStream)
console.log(w1.finish()) // <= Prints the pure byte-encoding of the string
w2 = new Writer()
coder.encode("my string", w, Context.needsDelimiters)
console.log(w2.finish()) // <= Prints a length-prefix string of bytes

Enumeration Members

Enumeration Members

needsDelimiters: "needsDelimiters"

Needs-delimiters encoding means that the encoding of data must be such that when decoding, the coder is able to stop decoding data at the end of the current element.

wholeStream: "wholeStream"

Whole stream encoding/decoding means that the encoding/decoding function does not need to worry about delimiting the start and end of the current element in the stream of bytes.

Generated using TypeDoc