Module vopu :: Class StringStream
[show private | hide private]
[frames | no frames]

Type StringStream

object --+
         |
        StringStream


Stream which writes into a byte string.

>>> stream = StringStream()
>>> stream.content
''
>>> stream.write("foo")
>>> stream.content
'foo'
>>> stream.write("bar")
>>> stream.content
'foobar'
>>> print >>stream, "spam"
>>> stream.content
'foobarspam\n'
>>> str(stream)
'foobarspam\n'
>>> stream.content = "new content"
>>> print >>stream, "Z"
>>> print >>stream, "Line2"
>>> stream.content
'new contentZ\nLine2\n'

Method Summary
  __init__(self, content, *args, **kwargs)
Create a new StringStream.
  __str__(self)
Return the content of this stream.
  write(self, str)
Write a string into this stream.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Method Details

__init__(self, content='', *args, **kwargs)
(Constructor)

Create a new StringStream.

>>> stream = StringStream()
>>> stream.content
''
>>> stream = StringStream("spam")
>>> stream.content
'spam'
Parameters:
content -

initial content (default: "")

Overrides:
__builtin__.object.__init__

__str__(self)
(Informal representation operator)

Return the content of this stream.

In other words, return the concatenation of all strings that have been written into this stream.

Overrides:
__builtin__.object.__str__

write(self, str)

Write a string into this stream.

That means, append the given string to this stream's content.

Parameters:
str -

byte string to write into this stream


Generated by Epydoc 2.1 on Sun Aug 31 15:41:30 2008 http://epydoc.sf.net