Home > Language Reference > Classes

StreamExg Class

  + Object
    + Stream
      + StreamExg

Description

The StreamExg class implements a stream allowing data transfers between two handhelds devices via the Palm OS® Exchange Manager. This class is not cloneable nor derivable (see also Data Streams).

When you want to send data, you should instance this class and call its Connect method to establish a connection with the remote handheld device. You can then write the data to be sent with the Write method. When all the data has been written, you should close the connection with the Disconnect method. For example:

Private Sub Button1_Click()
  Dim s As New StreamExg

  s.Connect "filename.ext"
  s.Write "Some data..."
  s.Disconnect
End Sub

From Palm OS 4.0®, you can send multiple objects within the same connection, using the NextObject method. Refer to the description of this method for further information.

On the other hand, when you want to receive data, you should implement the ExgAskUser and ExgReceive events of the Application object. This last event gives you an instance of the StreamExg class that you can use to read data using the Read function. You should also register your application to the system to receive using the RegisterExtension method. The following example shows how to receive a character string from the previous example:

Private Sub Application_SyncNotify()
  RegisterExtension "ext"
End Sub

Private Sub Application_ExgAskUser(ByVal sFilename As String, ByRef eResult As HbExgAsk)
  eResult=hbExgAskOk
End Sub

Private Sub Application_ExgReceive(ByVal stream As StreamExg, ByRef itemGoto As ItemInfo)
  Dim data As String
  stream.Read data
End Sub

As all exchange streams are implemented as serial communication streams, this class is not able to use Seek, SeekToBegin, SeekToEnd, Position and Size. Refer to the description of the Stream object for further information.

The Autograph sample or MiniLauncher shows how use the StreamExg class for data exchange.

Members

MembersDescription
Connect Establishes a connection with a remote handheld device.
Disconnect Closes a connection.
NextObject Begins sending a new object.
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.0N/A