class Puma::IOBuffer - puma-3.11.4 Documentation

# class Puma::IOBuffer

### Constants

BUF_DEFAULT_SIZE

### Public Class Methods

new() click to toggle source

    # File lib/puma/java_io_buffer.rb, line 14
    def initialize
      @buf = JavaIOBuffer.new(BUF_DEFAULT_SIZE)
    end

### Public Instance Methods

<<(str) click to toggle source

    # File lib/puma/java_io_buffer.rb, line 22
    def <<(str)
      bytes = str.to_java_bytes
      @buf.write(bytes, 0, bytes.length)
    end

append(*strs) click to toggle source

    # File lib/puma/java_io_buffer.rb, line 27
    def append(*strs)
      strs.each { |s| self << s; }
    end

capacity() click to toggle source

    # File lib/puma/java_io_buffer.rb, line 41
    def capacity
      @buf.buf.length
    end

reset() click to toggle source

    # File lib/puma/java_io_buffer.rb, line 18
    def reset
      @buf.reset
    end

to_s() click to toggle source

    # File lib/puma/java_io_buffer.rb, line 31
    def to_s
      String.from_java_bytes @buf.to_byte_array
    end

Also aliased as: to_str
to_str()
Alias for: to_s
used() click to toggle source

    # File lib/puma/java_io_buffer.rb, line 37
    def used
      @buf.size
    end