# ***********************************************
# !!!! DO NOT EDIT !!!!
# This file was auto-generated by Build.PL.
# ***********************************************
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

=encoding utf8

=head1 NAME

Clownfish::ByteBuf - Growable buffer holding arbitrary bytes.


    my $buf = Clownfish::ByteBuf->new($byte_string);
    my $byte_string = $buf->to_perl;



=head2 new

    my $buf = Clownfish::ByteBuf->new($byte_string);

Create a ByteBuf containing the passed-in bytes.

=head1 METHODS

=head2 set_size


Resize the ByteBuf to C<size>.  If greater than the object’s capacity,
throws an error.

=head2 get_size

    my $int = $byte_buf->get_size();

Return the size of the ByteBuf in bytes.

=head2 get_capacity

    my $int = $byte_buf->get_capacity();

Return the number of bytes in the ByteBuf’s allocation.

=head2 cat


Concatenate the contents of L<Blob|Clownfish::Blob> C<blob> onto the end of the
original ByteBuf. Allocate more memory as needed.

=head2 yield_blob

    my $blob = $byte_buf->yield_blob();

Return the content of the ByteBuf as L<Blob|Clownfish::Blob> and clear the ByteBuf.

=head2 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.

=head2 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.

=head2 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 C<other> is not a ByteBuf.

Returns: 0 if the ByteBufs are equal, a negative number if C<self> is
less than C<other>, and a positive number if C<self> is greater than

=head2 clone

    my $result = $byte_buf->clone();

Return a clone of the object.


Clownfish::ByteBuf isa L<Clownfish::Obj>.