core.buffer | index

`This module adds the buffer support to the python vert.x platform`

Classes

``

__builtin__.object
  Buffer

class Buffer(__builtin__.object)

``

`A Buffer represents a sequence of zero or more bytes that can be written to or read from, and which expands
as necessary to accomodate any bytes written to it.
Buffers are used in many places in vert.x, for example to read/write data to/from NetSocket, AsyncFile,
WebSocket, HttpClientRequest, HttpClientResponse, HttpServerRequest, HttpServerResponse etc.
There are two ways to write data to a Buffer: The first method involves methods that take the form set_XXX.
These methods write data into the buffer starting at the specified position. The position does not have to be inside data that
has already been written to the buffer; the buffer will automatically expand to encompass the position plus any data that needs
to be written. All positions are measured in bytes and start with zero.
The second method involves methods that take the form append-XXX; these methods append data at the end of the buffer.
Methods exist to both set and append all primitive types, String and other instances of Buffer.
Data can be read from a buffer by invoking methods which take the form get_XXX. These methods take a parameter
representing the position in the Buffer from where to read data.
`

Methods defined here:

__init__(self, buffer)

__repr__(self)
  `String representation of buffer`

append_buffer(self, buff)
  `Appends a buffer to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.`

append_fixnum(self, num, bytes)
  `Appends a fixnum to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.`

append_float(self, num, bytes)
  `Appends a float to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.`

append_str(self, str, enc='UTF-8')
  `Appends a string to the end of this buffer. The buffer will expand as necessary to accomodate any bytes written.`

copy(self)
  `Get a copy of the entire buffer.`

get_buffer(self, pos, end_pos)
  `Return bytes in the buffer as a Buffer`

get_byte(self, pos)
  `Get the byte at position pos in the buffer.`

get_fixnum(self, pos, bytes)
  `Get the fixnum represented by a sequence of bytes starting at position pos in the buffer.`

get_float(self, pos, bytes)
  `Get the float represented by a sequence of bytes starting at position pos in the buffer.`

get_string(self, pos, end_pos, enc='UTF-8')
  `Return bytes from the buffer interpreted as a String`

set_buffer(self, pos, buff)
  `Sets bytes in this buffer to the bytes of the specified buffer. The buffer will expand as necessary to accomodate any bytes written.`

set_fixnum(self, pos, num, bytes)
  `Sets bytes in the buffer to a representation of a fixnum. The buffer will expand as necessary to accomodate any bytes written.`

set_float(self, pos, num, bytes)
  `Sets bytes in the buffer to a representation of a float. The buffer will expand as necessary to accomodate any bytes written.`

set_string(self, pos, str, enc='UTF-8')
  `Set bytes in the buffer to the string encoding in the specified encoding`

to_string(self, enc='UTF-8')
  `Buffer in enc encoding`

Static methods defined here:

create(initial_size_hint=0)
  `Creates a new empty buffer. initial_size_hint is a hint to the system for how much memory to initially allocate.`

create_from_str(str, enc='UTF-8')
  `Create a buffer from a string in the enc encoding`

Data descriptors defined here:

__dict__
  `dictionary for instance variables (if defined)`

__weakref__
  `list of weak references to the object (if defined)`

length
  `The length of this buffer, in bytes.`

Data
`` |  | __author__ = 'Scott Horn' __credits__ = 'Based entirely on work by Tim Fox http://tfox.org' __email__ = 'scott@hornmicro.com' org = <java package org 0x2>

Author
`` |  | Scott Horn

Credits
`` |  | Based entirely on work by Tim Fox http://tfox.org