clarified how to best read and write bytes
svn: r16372 original commit: 0bd8b828e93d882a570ab47cbaa99d8deaa1efe7
This commit is contained in:
parent
05873b8c54
commit
c115dc4ee2
|
@ -78,8 +78,13 @@ Returns the next floating-point value in the stream.
|
||||||
@defmethod[(get-unterminated-bytes [len (or/c (box/c exact-nonnegative-integer?) false/c) #f])
|
@defmethod[(get-unterminated-bytes [len (or/c (box/c exact-nonnegative-integer?) false/c) #f])
|
||||||
(or/c bytes? false/c)]{
|
(or/c bytes? false/c)]{
|
||||||
|
|
||||||
Returns the next byte string from the stream. Reading from a bad
|
Returns the next byte string from the stream. This is
|
||||||
stream returns @scheme[#f] or @scheme[""].
|
the recommended way to read bytes back in from a stream;
|
||||||
|
use @method[editor-stream-in% put] with two arguments
|
||||||
|
(passing along the length of the bytes) to write out the bytes
|
||||||
|
to match this method.
|
||||||
|
|
||||||
|
Reading from a bad stream returns @scheme[#f] or @scheme[#""].
|
||||||
|
|
||||||
Note that when @method[editor-stream-out% put] is not given a byte
|
Note that when @method[editor-stream-out% put] is not given a byte
|
||||||
length, it includes an extra byte for a nul terminator; use
|
length, it includes an extra byte for a nul terminator; use
|
||||||
|
|
|
@ -64,7 +64,9 @@ Writes @scheme[v], or @scheme[n] bytes of @scheme[v].
|
||||||
|
|
||||||
When @scheme[n] is supplied with a byte-string @scheme[v], use
|
When @scheme[n] is supplied with a byte-string @scheme[v], use
|
||||||
@method[editor-stream-in% get-unterminated-bytes] to read the bytes
|
@method[editor-stream-in% get-unterminated-bytes] to read the bytes
|
||||||
later.
|
later. This is the recommended way to write out bytes to
|
||||||
|
be easily read in later; use @method[editor-stream-in%
|
||||||
|
get-unterminated-bytes] to read the bytes back in.
|
||||||
|
|
||||||
If @scheme[n] is not supplied and @scheme[v] is a byte string, then
|
If @scheme[n] is not supplied and @scheme[v] is a byte string, then
|
||||||
for historical reasons, the actual number of bytes written includes a
|
for historical reasons, the actual number of bytes written includes a
|
||||||
|
|
Loading…
Reference in New Issue
Block a user