Arena
1.0
A content management system
|
The base file stream class, from which all others are derived. More...
Public Member Functions | |
def | init |
Initialize a new file stream instance. More... | |
def | close |
Close the file and flush any remaining data to disk. More... | |
def | __del__ |
Destroy the file stream instance. More... | |
def | toString |
Return a string representation of the file stream. More... | |
def | position |
Return the current position within the stream. More... | |
def | moveTo |
Set the current position within the stream. More... | |
def | length |
Return the current length of the stream, in bytes. More... | |
def | fileName |
Retrieve the name of the file being streamed. 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... | |
The base file stream class, from which all others are derived.
This class does not implement the read() and write() methods it inherites from AStream. Consequently, this class should never be instantiated directly.
def Library.IO.FileStreams.AFileStream.__del__ | ( | Self | ) |
Destroy the file stream instance.
This routine calls AFileStream.close() to ensure that the stream is closed and any remaining data is flushed to the disk before the instance is destroyed.
def Library.IO.FileStreams.AFileStream.close | ( | Self | ) |
Close the file and flush any remaining data to disk.
This routine is called automatically by the destructor for AFileStream; however, there may be instances when it is desirable to explicity call this method (such as when finished writing to a log file), since Python's reference counting scheme does not guarantee that the destructor will be called at a specific time.
Descendant classes that override this method should gracefully handle multiple calls to this routine.
def Library.IO.FileStreams.AFileStream.fileName | ( | Self | ) |
Retrieve the name of the file being streamed.
def Library.IO.FileStreams.AFileStream.init | ( | Self | ) |
Initialize a new file stream instance.
This routine clears the attributes of the class.
def Library.IO.FileStreams.AFileStream.length | ( | Self | ) |
Return the current length of the stream, in bytes.
Depending on the file being streamed, it can be time-consuming to use this method, as it must save the current position within the stream, traverse the stream to the end of the file, determine what offset that is, then return to the previous position within the stream. This method should therefore be used sparingly.
def Library.IO.FileStreams.AFileStream.moveTo | ( | Self, | |
newPosition | |||
) |
Set the current position within the stream.
The current position within the stream is measured as the number of bytes from the beginning of the stream, which is always located at position zero (0). If newPosition
specifies an offset that is less than zero, it is assumed to indicate a position within the stream relative to the end of the stream (i.e., AFileStream.length + newPosition
+ 1). The end of the stream is always located at offset -1.
def Library.IO.FileStreams.AFileStream.position | ( | Self | ) |
Return the current position within the stream.
The current position within the stream is measured as the number of bytes from the beginning of the stream, which is always located at position zero (0).
def Library.IO.FileStreams.AFileStream.toString | ( | Self | ) |
Return a string representation of the file stream.
The representation returned is the name of the file being streamed.