-
-
27 Feb 2018 08:38:55 UTC
- Distribution: Clownfish
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Clone repository
- Issues
- Testers (1313 / 0 / 7)
- Kwalitee
Bus factor: 0- License: apache_2_0
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (230.31KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The Apache Lucy Project <dev at lucy dot apache dot org>
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Clownfish::ByteBuf - Growable buffer holding arbitrary bytes.
SYNOPSIS
my $buf = Clownfish::ByteBuf->new($byte_string); my $byte_string = $buf->to_perl;
DESCRIPTION
CONSTRUCTORS
new
my $buf = Clownfish::ByteBuf->new($byte_string);
Create a ByteBuf containing the passed-in bytes.
METHODS
set_size
$byte_buf->set_size($size);
Resize the ByteBuf to
size
. If greater than the object’s capacity, throws an error.get_size
my $int = $byte_buf->get_size();
Return the size of the ByteBuf in bytes.
get_capacity
my $int = $byte_buf->get_capacity();
Return the number of bytes in the ByteBuf’s allocation.
cat
$byte_buf->cat($blob);
Concatenate the contents of Blob
blob
onto the end of the original ByteBuf. Allocate more memory as needed.yield_blob
my $blob = $byte_buf->yield_blob();
Return the content of the ByteBuf as Blob and clear the ByteBuf.
utf8_to_string
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.
trusted_utf8_to_string
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.
compare_to
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 thanother
, and a positive number ifself
is greater thanother
.clone
my $result = $byte_buf->clone();
Return a clone of the object.
INHERITANCE
Clownfish::ByteBuf isa Clownfish::Obj.
Module Install Instructions
To install Clownfish, copy and paste the appropriate command in to your terminal.
cpanm Clownfish
perl -MCPAN -e shell install Clownfish
For more information on module installation, please visit the detailed CPAN module installation guide.