struct RPM::TagData::ReturnTypeBin
- RPM::TagData::ReturnTypeBin
- RPM::TagData::ReturnTypeBase
- Struct
- Value
- Object
Overview
Binary type for TagData
NOTE The raw representation of binary data is same to array of UInt8. RPM does not provide a way to obtain the pointer directly, and we need to convert back from string representation.
Included Modules
Defined in:
rpm/tagdata.crInstance Method Summary
-
#bytes(&block : String, Char?, Char? -> _)
Generates binary data from hexadecimal string representation.
-
#bytes
Generates binary data from hexadecimal string representation.
-
#bytes? : Bytes?
Generates binary data from hexadecimal string representation.
-
#size
rpmtdCount
should always returns 1 too. -
#to_a : Array(Bytes)
Respond to
Indexable#to_a
Instance methods inherited from struct RPM::TagData::ReturnTypeBase
detach
detach,
format(io : IO, index : Int, fmt : TagDataFormat)format(index : Int, fmt : TagDataFormat)
format(io : IO, fmt : TagDataFormat) format, return_type return_type, size size, tag tag, tag=(tag : Tag | TagValue) tag=, to_a to_a, to_unsafe : RPM::LibRPM::TagData to_unsafe, type type, unsafe_fetch(index : Int) unsafe_fetch
Constructor methods inherited from struct RPM::TagData::ReturnTypeBase
new
new
Instance Method Detail
Generates binary data from hexadecimal string representation.
Yield block if the string representations contains error.
- First block argument is always converted string.
- If the string length reported by upstream API is odd, both Char arguments are nil.
- Otherwise two
Char
s will be each slice of the string, but second Char can be nil if it is '\0'.
Returns the result of block if error.
NOTE The type will be ignored. So if a string data consists
of hexadecimal characters (ex: `aa`), it will convert to
binary (here `Bytes[0xaa]` will be returned).
NOTE This method is intended to use for TagType::BIN
data.
So `0x` or `0X` prefix is prohibited, which never be
appeared for `TagType::BIN` data.
Generates binary data from hexadecimal string representation.
Raises IndexError
if the length of the string is an odd
number.
Raises TypeCastError
if the string contains non-hexadecimal
character
NOTE The type will be ignored. So if a string data consists
of hexadecimal characters (ex: `aa`), it will convert to
binary (here `Bytes[0xaa]` will be returned).
NOTE This method is intended to use for TagType::BIN
data.
So `0x` or `0X` prefix is prohibited, which never be
appeared for `TagType::BIN` data.
Generates binary data from hexadecimal string representation.
Returns nil
if the string representation is not valid.
NOTE The type will be ignored. So if a string data consists
of hexadecimal characters (ex: `aa`), it will convert to
binary (here `Bytes[0xaa]` will be returned).
NOTE This method is intended to use for TagType::BIN
data.
So `0x` or `0X` prefix is prohibited, which never be
appeared for `TagType::BIN` data.
Respond to Indexable#to_a