Arena
1.0
A content management system
|
A class that allows strings to be used as though they are streams. More...
Public Member Functions | |
def | __init__ |
Construct a new string stream instance. More... | |
def | __del__ |
Destroy the string stream instance. More... | |
def | init |
Initialize a new string stream instance. More... | |
def | close |
Close the stream. | |
def | readFormat |
Read the specified values from the stream. More... | |
def | writeFormat |
Write each value to the stream. More... | |
def | read |
Read the specified values from the stream. More... | |
def | write |
Write the specified values to the stream. More... | |
def | readFrom |
Read the contents of the string stream from another stream. More... | |
def | writeTo |
Write the contents of the string stream to another stream. More... | |
def | toString |
Return a string representation of the stream. More... | |
def | position |
Retrieve the current position within the stream. More... | |
def | moveTo |
Set the current position within the stream. More... | |
def | length |
Retrieve the current length of the stream. More... | |
Public Member Functions inherited from Library.IO.Streams.AStream | |
def | __init__ |
Construct a new stream instance. More... | |
def | init |
Initialize the stream instance. More... | |
def | readFormat |
Read one or more values from the stream. More... | |
def | writeFormat |
Write one or more values to the stream. More... | |
def | read |
Read one or more values from the stream. More... | |
def | write |
Write the specified values to the stream. More... | |
def | writeString |
Write a string to the stream, including a length specifier. More... | |
def | readString |
Read a string from the stream. More... | |
def | rewindBy |
Rewind the stream by the specified number of bytes. | |
def | position |
Return the current position within the stream. More... | |
def | moveTo |
Set the current position within the stream. More... | |
def | length |
Get the current length of the stream, in bytes. More... | |
def | __len__ |
Get the current length of the stream, in bytes. More... | |
def | hasEnded |
Determine whether or not the end of the stream has been reached. More... | |
Public Member Functions inherited from Library.Base.Classwork.AnObject | |
def | init |
Initialize a new object instance. More... | |
def | __init__ |
Construct and initialize a new instance of AnObject. More... | |
def | __del__ |
Destroy the object instance. More... | |
def | displayName |
Construct a "pretty" display name for the class instance, based on the name of its class. More... | |
def | implements |
Determine whether the class instance is related to the specified class. More... | |
def | toString |
Return a string representation of the class, suitable for output to a console or text-based device. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | classname |
Return the name of the class from which the instance was created. More... | |
def | name |
Return the name of the class. More... | |
Public Member Functions inherited from Library.IO.Streams.IsStreamable | |
def | writeTo |
Write class instance data to the specified stream. More... | |
def | readFrom |
Read class instance data from the specified stream. More... | |
A class that allows strings to be used as though they are streams.
Both read and write operations are supported.
def Library.IO.StringStreams.AStringStream.__init__ | ( | Self, | |
values | |||
) |
Construct a new string stream instance.
def Library.IO.StringStreams.AStringStream.__del__ | ( | Self | ) |
Destroy the string stream instance.
This routine calls the AStringStream.close() method automatically.
def Library.IO.StringStreams.AStringStream.init | ( | Self | ) |
Initialize a new string stream instance.
This routine installs a private attribute named "Handle" that represents the underlying StringIO object used by the stream.
def Library.IO.StringStreams.AStringStream.length | ( | Self | ) |
Retrieve the current length of the stream.
This value is the length of the underlying string.
def Library.IO.StringStreams.AStringStream.moveTo | ( | Self, | |
newPosition | |||
) |
Set the current position within the stream.
This is the position at which the next read or write operation will occur. The position within the stream is measured as the number of bytes to the start of the stream. The beginning of the stream is always at offset zero (0).
If newPosition
specifies a value less than zero, it is assumed to indicate an offset relative to the END of the stream (i.e., newPosition
+ AStringStream.length + 1). In this case, the end of the stream is always located at offset -1.
def Library.IO.StringStreams.AStringStream.position | ( | Self | ) |
Retrieve the current position within the stream.
This is the position within the stream at which the next read or write operation will occur. The position is measured as the number of bytes to the start of the stream, with the beginning of the stream at offset zero (0).
def Library.IO.StringStreams.AStringStream.read | ( | Self, | |
values | |||
) |
Read the specified values
from the stream.
Each item in the list of values is filled with a single line from the stream.
values
. The value associated with each key is a single line from the stream. The dictionary will contain one additional element: an item named "result"
that indicates how many bytes were read from the stream. def Library.IO.StringStreams.AStringStream.readFormat | ( | Self, | |
fmt, | |||
values | |||
) |
Read the specified values
from the stream.
The fmt
parameter is assumed to contain the name of the first item to be read from the stream, even as the items in values
are assumed to name each subsequent line read from the stream.
values
. The dictionary object will also contain an item named "result"
which indicates how many bytes were read from the stream. If values
and fmt
are empty, this routine will return zero (0). def Library.IO.StringStreams.AStringStream.readFrom | ( | Self, | |
Source | |||
) |
Read the contents of the string stream from another stream.
Depending on the type of source stream provided, this routine has the potential to read the ENTIRE contents of that stream into memory. Be very careful when using this method!
Source
. def Library.IO.StringStreams.AStringStream.toString | ( | Self | ) |
Return a string representation of the stream.
This method merely returns the contents of the underlying string.
def Library.IO.StringStreams.AStringStream.write | ( | Self, | |
values | |||
) |
Write the specified values
to the stream.
Each item in the list of values
is converted to a string before it is written.
value
is empty, the return value will be zero (0). def Library.IO.StringStreams.AStringStream.writeFormat | ( | Self, | |
fmt, | |||
values | |||
) |
Write each value
to the stream.
The fmt
parameter is written first, followed by the items in values
. Each item is converted to a string before it is written.
def Library.IO.StringStreams.AStringStream.writeTo | ( | Self, | |
Dest | |||
) |
Write the contents of the string stream to another stream.
Dest
.