Water 5-Common Data Types-String, Bytes, and CharCollection of data bytes
Contract| Parameter key | Default value | Type | | ends_at | opt | | value | opt | | Parameter kind | Default value | Type | | Other unkeyed arguments | opt with ekind of bytes | wob | | Water Contract<class bytes
ends_at=opt
value =opt
_other_unkeyed=opt=wob=ekind.bytes="_add_to_environment"
/> | |
See also: wob, vector, string, char
A bytes object can hold arbitrary binary data. A simple example
of a bytes object can be created by using <bytes>...</bytes>
to enclose the data. The individual bytes are treated as data of type
char .
<bytes>the data</bytes>.0
"the data"
Notice the use of the .0 notation to retrieve the bytes stored by
the object. Individual bytes can be accessed by using further dot notation.
Example: Get byte at position 4 (zero-relative)
<bytes>the data</bytes>.0.4
char.d
Note that ConciseXML implicit ending tag "</>" does not terminate a
bytes object.
<bytes>need explicit ending tag</></bytes>.0
 | "need explicit ending tag</>" |
a wob
| Parameter key | Default value | Type |
| ends_at | opt |
When the data intended for a bytes object contains characters
that will cause Water to throw a parse error, it is possible to
designate a number of characters for the system to copy into the
bytes object—without interpreting them—by using the ends_at
field.
<bytes ends_at=8></bytes></bytes>.0
 | "</bytes>" |
The number of bytes to be skipped must be exactly the number
of bytes between the opening and closing bytes tags or an
error will result.
a wob
| Parameter key | Default value | Type |
| value | opt |
The content of the bytes object may also be set by assigning the
value field.
<bytes value="</bytes>" />.0
"</bytes>"
In the example above, the presence of the string "</bytes>" would
have prematurely terminated the bytes object; however, the use of
the value field allowed us to set the string "</bytes>" as
the content of the object without causing an error.
© Copyright 2007 Clear Methods, Inc.