Water 5-Common Data Types-String, Bytes, and Char
class bytes
Collection of data bytes
Contract
Parameter keyDefault valueType
ends_atopt
valueopt
Parameter kindDefault valueType
Other unkeyed argumentsopt with ekind of byteswob
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.4char.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 keyDefault valueType
ends_atopt
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 keyDefault valueType
valueopt
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.