Streamed binaries always use ByteString chunks

This commit is contained in:
Tony Garnock-Jones 2018-09-24 23:15:36 +01:00
parent a9445b2ca7
commit 0444a2a096
1 changed files with 6 additions and 6 deletions

View File

@ -363,7 +363,8 @@ by a single Stream Start (“open”) byte, followed by zero or more
close(t,n) = leadbyte(0,3, t*4 + n)
For a `Repr` of a `Value` containing binary data, each chunk is to be
a format B `Repr` of the same type as the overall `Repr`.
a format B `Repr` of a `ByteString`, no matter the type of the overall
`Repr`.
For a `Repr` of a `Value` containing other `Value`s, each chunk is to
be a single `Repr`.
@ -513,8 +514,7 @@ Format B (known length):
To stream a `String`, `ByteString` or `Symbol`, emit `open(1,n)` and
then a sequence of zero or more format B chunks, followed by
`close(1,n)`. For a `String`, every chunk must be a `String`;
likewise, for `ByteString` and `Symbol`.
`close(1,n)`. Every chunk must be a `ByteString`.
While the overall content of a streamed `String` or `Symbol` must be
valid UTF-8, individual chunks do not have to conform to UTF-8.
@ -556,8 +556,8 @@ short form label number 0 to label `discard`, 1 to `capture`, and 2 to
| `[1 2 3 4]` (format C) | 2C 11 12 13 14 3C |
| `[-2 -1 0 1]` | C4 1E 1F 10 11 |
| `"hello"` (format B) | 55 68 65 6C 6C 6F |
| `"hello"` (format C, 2 chunks) | 25 52 68 65 53 6C 6C 6F 35 |
| `"hello"` (format C, 5 chunks) | 25 52 68 65 52 6C 6C 50 50 51 6F 35 |
| `"hello"` (format C, 2 chunks) | 25 62 68 65 63 6C 6C 6F 35 |
| `"hello"` (format C, 5 chunks) | 25 62 68 65 62 6C 6C 60 60 61 6F 35 |
| `["hello" there #"world" [] #set{} #t #f]` | C7 55 68 65 6C 6C 6F 75 74 68 65 72 65 C0 D0 01 00 |
| `-257` | 42 FE FF |
| `-1` | 1F |
@ -792,7 +792,7 @@ the same `Value` may yield different binary `Repr`s.
00 10 ttnn Start Stream <tt,nn>
When tt = 00 --> error
01 --> each chunk is a <tt,nn> piece
01 --> each chunk is a ByteString
1x --> each chunk is a single encoded Value
00 11 ttnn End Stream <tt,nn> (must match preceding Start Stream)