class NIO::ByteBuffer
def put(str)
-
(self)
-
Raises:
-
(NIO::ByteBuffer::OverflowError)
- buffer is full -
(TypeError)
- given a non-string type
Parameters:
-
str
(#to_str
) -- data to add to the buffer
def put(str) raise TypeError, "expected String, got #{str.class}" unless str.respond_to?(:to_str) str = str.to_str raise OverflowError, "buffer is full" if str.length > @limit - @position @buffer[@position...str.length] = str @position += str.length self end