Class: ByteBuffer::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/byte_buffer/buffer.rb,
ext/byte_buffer_ext/byte_buffer.c

Constant Summary collapse

DEFAULT_PREALLOC_SIZE =
INT2FIX(BYTE_BUFFER_EMBEDDED_SIZE)

Instance Method Summary collapse

Constructor Details

#initializeObject



15
# File 'ext/byte_buffer_ext/byte_buffer.c', line 15

static VALUE rb_byte_buffer_initialize(int argc, VALUE *argv, VALUE self);

Instance Method Details

#appendObject Also known as: <<



18
# File 'ext/byte_buffer_ext/byte_buffer.c', line 18

static VALUE rb_byte_buffer_append(VALUE self, VALUE str);

#append_byteObject



21
# File 'ext/byte_buffer_ext/byte_buffer.c', line 21

static VALUE rb_byte_buffer_append_byte(VALUE self, VALUE i);

#append_byte_arrayObject



25
# File 'ext/byte_buffer_ext/byte_buffer.c', line 25

static VALUE rb_byte_buffer_append_byte_array(VALUE self, VALUE ary);

#append_doubleObject



23
# File 'ext/byte_buffer_ext/byte_buffer.c', line 23

static VALUE rb_byte_buffer_append_double(VALUE self, VALUE i);

#append_floatObject



24
# File 'ext/byte_buffer_ext/byte_buffer.c', line 24

static VALUE rb_byte_buffer_append_float(VALUE self, VALUE i);

#append_intObject



20
# File 'ext/byte_buffer_ext/byte_buffer.c', line 20

static VALUE rb_byte_buffer_append_int(VALUE self, VALUE i);

#append_longObject



19
# File 'ext/byte_buffer_ext/byte_buffer.c', line 19

static VALUE rb_byte_buffer_append_long(VALUE self, VALUE i);

#append_shortObject



22
# File 'ext/byte_buffer_ext/byte_buffer.c', line 22

static VALUE rb_byte_buffer_append_short(VALUE self, VALUE i);

#capacityObject



16
# File 'ext/byte_buffer_ext/byte_buffer.c', line 16

static VALUE rb_byte_buffer_capacity(VALUE self);

#discardObject



26
# File 'ext/byte_buffer_ext/byte_buffer.c', line 26

static VALUE rb_byte_buffer_discard(VALUE self, VALUE n);

#dupObject



22
23
24
# File 'lib/byte_buffer/buffer.rb', line 22

def dup
  self.class.new(self.to_str)
end

#empty?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/byte_buffer/buffer.rb', line 9

def empty?
  self.length == 0
end

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


13
14
15
# File 'lib/byte_buffer/buffer.rb', line 13

def eql?(other)
  self.to_str.eql?(other.to_str)
end

#hashObject



18
19
20
# File 'lib/byte_buffer/buffer.rb', line 18

def hash
  to_str.hash
end

#indexObject



35
# File 'ext/byte_buffer_ext/byte_buffer.c', line 35

static VALUE rb_byte_buffer_index(int argc, VALUE *argv, VALUE self);

#inspectObject



38
# File 'ext/byte_buffer_ext/byte_buffer.c', line 38

static VALUE rb_byte_buffer_inspect(VALUE self);

#lengthObject Also known as: size, bytesize



17
# File 'ext/byte_buffer_ext/byte_buffer.c', line 17

static VALUE rb_byte_buffer_length(VALUE self);

#readObject



27
# File 'ext/byte_buffer_ext/byte_buffer.c', line 27

static VALUE rb_byte_buffer_read(VALUE self, VALUE n);

#read_byteObject



31
# File 'ext/byte_buffer_ext/byte_buffer.c', line 31

static VALUE rb_byte_buffer_read_byte(int argc, VALUE *argv, VALUE self);

#read_byte_arrayObject



34
# File 'ext/byte_buffer_ext/byte_buffer.c', line 34

static VALUE rb_byte_buffer_read_byte_array(int argc, VALUE *argv, VALUE self);

#read_doubleObject



32
# File 'ext/byte_buffer_ext/byte_buffer.c', line 32

static VALUE rb_byte_buffer_read_double(VALUE self);

#read_floatObject



33
# File 'ext/byte_buffer_ext/byte_buffer.c', line 33

static VALUE rb_byte_buffer_read_float(VALUE self);

#read_intObject



29
# File 'ext/byte_buffer_ext/byte_buffer.c', line 29

static VALUE rb_byte_buffer_read_int(int argc, VALUE *argv, VALUE self);

#read_longObject



28
# File 'ext/byte_buffer_ext/byte_buffer.c', line 28

static VALUE rb_byte_buffer_read_long(int argc, VALUE *argv, VALUE self);

#read_shortObject



30
# File 'ext/byte_buffer_ext/byte_buffer.c', line 30

static VALUE rb_byte_buffer_read_short(int argc, VALUE *argv, VALUE self);

#to_strObject Also known as: cheap_peek, to_s



37
# File 'ext/byte_buffer_ext/byte_buffer.c', line 37

static VALUE rb_byte_buffer_to_str(VALUE self);

#updateObject



36
# File 'ext/byte_buffer_ext/byte_buffer.c', line 36

static VALUE rb_byte_buffer_update(VALUE self, VALUE location, VALUE bytes);