Package pyGlobus :: Module util :: Class Buffer
[show private | hide private]
[frames | no frames]

Class Buffer


A wrapper class for globus_byte_t arrays.

Allows the manipulation of globus_byte_t arrays. This class malloc's the underlying memory in the constructor, and free's it during destruction. It supports returning the underlying memory as a python string. It also supports the readline and readlines methods.
Method Summary
  __init__(self, size)
Contruct a Buffer object.
  __del__(self)
Destroys the Buffer object.
  __len__(self)
Get the size of the Buffer object.
  as_string(self, size)
Convert the underlying globus_byte_t array into a Python string.
  get_handle(self)
Get the underlying pointer to the globus_byte_t array.
  get_size(self)
Get the size of the Buffer object.
  readline(self)
Return a single line as a string.
  readlines(self)
Return a list containing each line in the Buffer.
  set_handle(self, handle)
Sets a globus_byte_t array to a Buffer object

Method Details

__init__(self, size)
(Constructor)

Contruct a Buffer object. This methods causes underlying memory to be malloc'd.
Parameters:
size - The size of the buffer to create.
Raises:
GlobusBufferException - A GlobusBufferException is thrown if unable to create the buffer object.

__del__(self)
(Destructor)

Destroys the Buffer object.

Free's the underlying memory.

__len__(self)
(Length operator)

Get the size of the Buffer object.
Returns:
An int containing the size of the Buffer object.

as_string(self, size)

Convert the underlying globus_byte_t array into a Python string.
Parameters:
size - The number of bytes to convert.
Returns:
A string containg the contents of the Buffer.

get_handle(self)

Get the underlying pointer to the globus_byte_t array.
Returns:
A SWIG'ized pointer to the underlying byte array.

Warning: This handle is only valid as long as this object exists. When

get_size(self)

Get the size of the Buffer object.
Returns:
An int containing the size of the Buffer object.

readline(self)

Return a single line as a string.
Returns:
A string containing the next line in the Buffer.

readlines(self)

Return a list containing each line in the Buffer.
Returns:
A list of strings containing each line in the Buffer.

set_handle(self, handle)

Sets a globus_byte_t array to a Buffer object

Generated by Epydoc 2.1 on Tue Apr 4 14:32:53 2006 http://epydoc.sf.net