Convert Method for LCStream

This method obtains a stream in a particular stream format.

For related information, see the SetFormat method.

Defined In

LCStream

Syntax

Call newStream. Convert (srcStream, flags, format)

Parameters

Parameter

Description

srcStream

LCStream. Stream whose data is to be converted. The srcStream should not be the same object as the newStream.

flags

Long. Flags that determine aspects of the conversion. Zero or more of the following values, ORed together:

  • LCCONVERTF_REFERENCE -- Allows the destination stream to reference the source stream if they are of the same format. Otherwise, a data copy is always required. See Usage Notes.
  • LCCONVERTF_PRESERVE -- Preserves the destination stream meta-information (MaxLength and StreamFlags). Otherwise, they are taken from the source stream.
  • LCCONVERTF_FORCE_TEXT -- Overrides the DECSTranslation setting of 0 or 1 in the notes.ini file for text translation and forces it to occur between any different text character sets.

format

Long. Stream format of the destination data.

Usage Notes®

The use of the flag LCCONVERTF_REFERENCE supports an efficient method of obtaining stream data in a particular format. When requesting a stream in a specific format and using this flag, if the stream data is already in the same format, no data copying is done. The new stream simply references the data of the original stream.

When working with a stream that references another stream's data, do not delete the original stream until the referencing stream is no longer needed.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim msga As New LCStream (0, 0, LCSTREAMFMT_ASCII)
  Dim msgu As New LCStream
  msga.Text = "Peter Pan lived in Never Never Land."
  Call msgu.Convert (msga, 0, LCSTREAMFMT_UNICODE)
  Print "The length of the msg in ASCII is " & msga.Length & " while the length in Unicode is " & msgu.Length
End Sub

Example Output

The length of the msg in ASCII is 36, while the length in Unicode is 72.