Home > Language Reference > Classes

StreamFile Class

  + Object
    + Stream
      + StreamFile

Description

The StreamFile class allows manipulation of files stored on external media such as a Secure Digital or MultiMedia cards. The functionality offered by this object is only available on Palm OS® 4.0 and higher, and on handhelds devices equiped with an extension slot.

To manipulate a file, you should first obtain a reference to the volume it resides on, using the methods of the VFSVolume object. A volume reference is an integer which identifies the extension slot in which the card is fitted. Refer to the documentation of this object for further information.

You can then open a file from its name by calling the Open method, manipulate it using the Read, Write and other methods inherited from the Stream object. Finally, when you have finished using a file, you can close it using the Close method. File management with HB++ is not greatly different from file management on a desktop computer with other programming languages.

The Created, Accessed and Modified properties allow access respectively to creation dates, last access and last modification of a file. The Attributes property shows where to modify the file attributes.

Due to hardware constraints, reading and writing an expansion card is slow. To speed up file operations, the StreamFile object implements an efficient buffering mechanism. The default size of this internal buffer is 512 bytes, which should be suitable for most applications. However, you may want to tune this value if reading or writing appear to be slow. It may also be necessary to disable caching if you plan to retrieve the file handle embedded in the object to feed an external library. These operations can be achieved by changing the buffer size in the last parameter of the Open method.

The VFSDemo sample shows an example that uses this object in conjunction with the VFSVolume object.

Note: Depending on the type of media used, noteably on the Palm OS® emulator, the behavior of the StreamFile object can differ slightly.

Members

MembersDescription
Accessed Last file access date.
Attributes File attributes.
Close Closes a file.
Created File creation date.
EOF End of file indicator.
FileRef Returns the file handle.
Modified Last file modification date.
Open Creates and/or opens a file.
Truncate Truncates a file.
Inherited from StreamDescription
Position Stream pointer position.
Read Reads data from a stream.
Seek Moves the stream pointer.
SeekToBegin Moves the pointer to the beginning of the stream.
SeekToEnd Moves the pointer to the end of the stream.
Size Total size of the data in a stream.
Write Writes data to a stream.
Inherited from ObjectDescription
ClassID Returns the type identifier corresponding to the actual class of the object.
Implements Determines whether the object implements the features of a given class.
Iterate Event raised to iterate over the elements of a container object.
Recipient Recipient of events sent by the object.
Serialize Event raised to serialize the object content into a stream.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0Requires an expansion slot.