NAME

Mojo::Buffer - A Simple In-Memory Buffer

SYNOPSIS

    use Mojo::Buffer;

    my $buffer = Mojo::Buffer->new;
    $buffer->add_chunk('bar');
    my $foo = $buffer->remove(3);
    my $bar = $buffer->empty;

DESCRIPTION

Mojo::Buffer is a simple in-memory buffer.

ATTRIBUTES

Mojo::Buffer implements the following attributes.

raw_size

    my $size = $buffer->raw_size;
    $buffer  = $buffer->raw_size(23);

METHODS

Mojo::Buffer inherits all methods from Mojo::Base and implements the following new ones.

add_chunk

    $buffer = $buffer->add_chunk('foo');

contains

    my $position = $buffer->contains('something');

empty

    my $chunk = $buffer->empty;

get_line

   my $line = $buffer->get_line;

remove

    my $chunk = $buffer->remove(4);
    my $chunk = $buffer->remove(4, 'abcd');

size

    my $size = $buffer->size;

to_string

    my $string = $buffer->to_string;
    my $string = "$buffer";