Clownfish::ByteBuf - Growable buffer holding arbitrary bytes.
my $buf = Clownfish::ByteBuf->new($byte_string); my $byte_string = $buf->to_perl;
my $buf = Clownfish::ByteBuf->new($byte_string);
Create a ByteBuf containing the passed-in bytes.
$byte_buf->set_size($size);
Resize the ByteBuf to size
.
If greater than the object’s capacity,
throws an error.
my $int = $byte_buf->get_size();
Return the size of the ByteBuf in bytes.
my $int = $byte_buf->get_capacity();
Return the number of bytes in the ByteBuf’s allocation.
$byte_buf->cat($blob);
Concatenate the contents of Blob blob
onto the end of the original ByteBuf.
Allocate more memory as needed.
my $blob = $byte_buf->yield_blob();
Return the content of the ByteBuf as Blob and clear the ByteBuf.
my $string = $byte_buf->utf8_to_string();
Return a String which holds a copy of the UTF-8 character data in the ByteBuf after checking for validity.
my $string = $byte_buf->trusted_utf8_to_string();
Return a String which holds a copy of the UTF-8 character data in the ByteBuf, skipping validity checks.
my $int = $byte_buf->compare_to($other);
Indicate whether one ByteBuf is less than,
equal to,
or greater than another.
The byte contents of the ByteBufs are compared lexicographically.
Throws an exception if other
is not a ByteBuf.
Returns: 0 if the ByteBufs are equal,
a negative number if self
is less than other
,
and a positive number if self
is greater than other
.
my $result = $byte_buf->clone();
Return a clone of the object.
Clownfish::ByteBuf isa Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.