A BinData::Stringz object is a container for a zero (“0”) terminated string.
For convenience, the zero terminator is not necessary when setting the value. Likewise, the returned value will not be zero terminated.
require 'bindata' data = "abcd\x00efgh" obj = BinData::Stringz.new obj.read(data) obj.snapshot #=> "abcd" obj.num_bytes #=> 5 obj.to_binary_s #=> "abcd\000"
Stringz objects accept all the params that BinData::BasePrimitive does, as well as the following:
:max_length |
The maximum length of the string including the zero byte. |
Generated with the Darkfish Rdoc Generator 2.