ADO » Objects » Stream

Version: 2.5

The ADO Stream object provides access to a stream of binary data or text. By access, we mean the ability to read, write, and manage the stream.

For example, you can use the Record and Recordset objects to gain access to files on a Web server, and then use the Stream object to gain access and manipulate the actual contents of those files.

There are three major ways to obtain a Stream object:

  • From a URL pointing to a file, folder, or a Record object.
  • By instantiating a Stream object to store data for your application.
  • By opening the default Stream object associated with a Record object.

    Properties

    Charset

    Syntax: streamobject.CharSet = string
    string = streamobject.CharSet

    Sets or returns a string value that specifies into which character set the contents of a text Stream are to be translated.

    EOS

    Syntax: boolean = streamobject.EOS

    Returns a Boolean value indicating whether or not the current position is at the end of the stream.

    LineSeparator

    Syntax: streamobject.LineSeparator = LineSeparatorsEnum
    LineSeparatorsEnun = streamobject.LineSeparator

    Sets or returns a LineSeparatorEnum value that specifies which binary character to use as the line separator in a text Stream object.

    Mode

    Syntax: streamobject.Mode = ConnectModeEnum
    ConnectModeEnun = streamobject.Mode

    Sets or returns a ConnectModeEnum value that specifies the available permissions for modifying data.

    Position

    Syntax: streamobject.Position = long
    long = streamobject.Position

    Sets or returns a long value that specifies the current position, measured in bytes, from the beginning of the stream.

    Size

    Syntax: long = streamobject.Size

    Returns a long value that is the size in bytes of an opened Stream object.

    State

    Syntax: ObjectStateEnum = streamobject.State

    Returns a long value describing if the Stream object is open or closed.

    Type

    Syntax: streamobject.Type = StreamTypeEnum
    StreamTypeEnum = streamobject.Type

    Sets or returns a StreamTypeEnum value defining if the data is binary or text.

    Methods

    Cancel

    Syntax: streamobject.Cancel

    Cancels the execution of a pending Open call.

    Close

    Syntax: streamobject.Close

    Close a Stream object.

    CopyTo

    Syntax: streamobject.CopyTo DestStream, NumChars

    Copies the specified number of characters or bytes from one Stream object to another Stream object.

    Flush

    Syntax: streamobject.Flush

    Sends the contents of the Stream object to the underlying object that is the source of the Stream object.

    LoadFromFile

    Syntax: streamobject.LoadFromFile FileName

    Loads the contents of an existing file into an open Stream object.

    Open

    Syntax: streamobject.Open Source, Mode, OpenOptions, UserName, Password

    Opens a Stream object from a URL or Record object.

    Read

    Syntax: variant = streamobject.Read (NumBytes)

    Reads the specified number of bytes from a binary Stream object andreturns the data as a variant.

    ReadText

    Syntax: string = streamobject.ReadText (NumBytes)

    Reads the specified number of bytes from a text Stream object andreturns the data as a string.

    SaveToFile

    Syntax: streamobject.SaveToFile FileName, SaveOptions

    Copies (saves) the contents of an opened Stream object to a specified file.

    SetEOS

    Syntax: streamobject.SetEOS

    Sets the value of the EOS property to be the current position.

    SkipLine

    Syntax: streamobject.SkipLine

    Skips all of the characters on one entire line, including the next line separator, while reading a text stream.

    Write

    Syntax: streamobject.Write Buffer

    Writes a specified number of bytes of binary data to an opened Stream object without adding any intervening spaces.

    WriteText

    Syntax: streamobject.WriteText Data, Options

    Writes a specified text string to an opened Stream object without adding any intervening spaces or characters.