Class ByteString

The ByteString class represents a bag of bytes. A ByteString may have '\0' values embedded within it. It may also have data that is not valid as utf-8. The ByteString class currently does not support any primitive operations.

public define each_byte(fn: Function(Byte))

Call fn for each Byte within the given ByteString.

public define encode(encode: *String): Option[String]

Attempt to transform the given ByteString into a String. The action taken depends on the value of encode.

If encode is "error", then invalid utf-8 or embedded '\0' values within self will result in None.

public define size: Integer

Return the number of Byte values within self.

public define slice(start: *Integer, stop: *Integer): ByteString

Create a new ByteString copying a section of self from start to stop.

If a negative index is given, it is treated as an offset from the end of self, with -1 being considered the last element.

On error, this generates an empty ByteString. Error conditions are: