Arena  1.0
A content management system
 All Classes Files Functions Variables Pages
Library.IO.FileStreams.AFileInputStream Class Reference

This class represents a stream that is used to read binary data from a file. More...

+ Inheritance diagram for Library.IO.FileStreams.AFileInputStream:

Public Member Functions

def __init__
 Construct a new file stream instance and open fileName for reading. More...
 
def init
 Initialize the new file stream instance. More...
 
def readFormat
 Read each item named in values from the stream. More...
 
def length
 Get the current size of the stream. More...
 
- Public Member Functions inherited from Library.IO.FileStreams.AFileStream
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...
 

Detailed Description

This class represents a stream that is used to read binary data from a file.

Constructor & Destructor Documentation

def Library.IO.FileStreams.AFileInputStream.__init__ (   Self,
  fileName 
)

Construct a new file stream instance and open fileName for reading.

If fileName does not exist, it is created.

Member Function Documentation

def Library.IO.FileStreams.AFileInputStream.init (   Self)

Initialize the new file stream instance.

This routine sets up a new private attribute named "length" that is returned by AFileInputStream.length. This is more efficient than repeatedly seeking the end of the stream for each time AStream.length is queried, which is what would occur if the default implementation inherited from AFileStream was left in place.

def Library.IO.FileStreams.AFileInputStream.length (   Self)

Get the current size of the stream.

This routine overriddes the implementation inherited from AFileStream in order to provide one that is more efficient. Since AFileInputStream is read-only, its size will never change, and so the end of the stream is sought only once to determine its size. Subsequent calls to this method retrieve the stored size rather than causing another search for the end of the stream.

def Library.IO.FileStreams.AFileInputStream.readFormat (   Self,
  fmt,
  values 
)

Read each item named in values from the stream.

Returns
This method returns a dictionary object that associates each item named in values with a value read from the stream. The dictionary object also includes an item named "result" that indicates how much data was read from the stream.

If an error occurs while reading, an exception is thrown.


The documentation for this class was generated from the following file: