Stream Object | (Versions 2.5, 2.6) |
A Stream object represents a stream of data that is obtained from a URL, a Record object, or nothing at all. |
Stream.Cancel Method | (Versions 2.5, 2.6) |
record.Cancel | |
The Cancel method cancels an asynchronous operation for the Stream object. |
|
Description | |
The Cancel method cancels an asynchronous operation of the Record object invoked by the Open method. |
|
See Also | |
Stream.Open Method |
|
Stream.CharSet Property | (Versions 2.5, 2.6) |
stream.CharSet = characterset | |
The CharSet property indicates the character set to whioch the contents of a text Stream should be translated. |
|
Datatype | |
String |
|
Description | |
The CharSet property can be set to a valid character set only if the Position property of the Stream object is set to 0. Valid character sets for a system are defined in the HKEY_CLASSES_ROOT\MIME\Database\CharSet subkeys. The default value for the CharSet property is "unicode". If the character set is changed on the fly, the data is translated as it is read from the stream and passed to the application. When writing data, the information is translated before being saved to the data source. This property is only valid for text streams, which are Stream objects having a value of adTypeText for their Type property value. |
|
See Also | |
Stream.Type Property |
|
Stream.Close Method | (Versions 2.5, 2.6) |
record.Close | |
The Close method closes an opened Stream object. |
|
Description | |
The Close method can be called only on an open Stream object. After calling the Close method, the Open method can be called again to reopen the Stream object. Calling the Close method releases any resources allocated to the Stream object. |
|
Stream.CopyTo Method | (Versions 2.5, 2.6) |
stream.CopyTo DestStream, NumChars | |
The CopyTo method copies data from one stream to another. |
|
Arguments | |
|
|
Description | |
The CopyTo method copies data from the source Stream object starting at the current stream pointer position (indicated by the Stream.Position property). The number of characters copied is either the number indicated by the NumChars argument or the rest of the source stream if the NumChars argument is greater than the number of remaining characters in the source stream or the NumChars argument value is -1. The stream pointer position of the destination Stream object is automatically set to the next byte available in the Stream object. The CopyTo method will not remove excess data from the destination Stream object past the copy. To do this, call the SetEOS method. You can copy data from a textual Stream to a binary Stream object, but not from a binary Stream to a textual Stream object. |
|
See Also | |
Stream.Position Property, Stream.SetEOS Method |
|
Stream.EOS Property | (Versions 2.5, 2.6) |
Boolean = stream.EOS | |
The EOS property indicates that the stream pointer is currently at the end of the stream. |
|
Datatype | |
Boolean |
|
Description | |
The EOS property is True when the stream pointer is located directly after the last piece of information within the stream and is now pointing to the End-Of-Stream pointer. |
|
Stream.Flush Method | (Versions 2.5, 2.6) |
stream.Flush | |
The Flush method ensures that all changes made to a Stream object have been persisted to the resource that the Stream object represents. |
|
Description | |
The Flush method persists any outstanding changes of the Stream object to the resource that is represented by the Stream object. Microsoft claims that this is very rarely necessary, as ADO calls this method internally in the background whenever possible. In addition, when closing a Stream object, the stream is first flushed to the data source. |
|
Stream.LineSeparator Property | (Versions 2.5, 2.6) |
stream.LineSeparator = lineseparator | |
The LineSeparator indicates the character (or characters) that are used to indicate the end of a line in text streams. |
|
Datatype | |
LineSeparatorEnum |
|
Description | |
The default value for the LineSeparator property is adCRLF, which indicates both a carriage return and a line feed. This property is valid only for text streams, which are Stream objects having a value of adTypeText for their Type property value. |
|
See Also | |
LineSeparatorEnum Enumeration, Stream.SkipLine Method |
|
Stream.LoadFromFile Method | (Versions 2.5, 2.6) |
stream.LoadFromFile FileName | |
The LoadFromFile method loads a file contents into an already open Stream object. |
|
Arguments | |
|
|
Description | |
The LoadFromFile method works only with an already opened Stream object, replacing the contents of the object with the contents of the file specified within the LoadFromFile argument, FileName. All pre-existing data is overwritten, and any extra data is truncated. However, the Stream object does not lose its relationship to the resource with which it was originally opened. The LoadFromFile method can be used to upload a file to a server from a client. |
|
Stream.Mode Property | (Versions 2.5, 2.6) |
stream.Mode = ConnectModeEnum | |
The Mode property indicates the permissions for modifying data within a Stream object. |
|
Datatype | |
ConnectModeEnum |
|
Description | |
The default value for the Mode property of a Stream object that is associated with an underlying source is adModeRead. Stream objects that are instantiated in memory have a default value of adModeUnknown for the Mode property. The Mode property is read- and write-enabled while the Stream object is closed, but read-only once it is opened. If the Mode property is not specified for a Stream object, it is inherited from the source used to open the object, such as a Record object. |
|
See Also | |
ConnectModeEnum Enumeration, Stream.Open Method |
|
Stream.Open Method | (Versions 2.5, 2.6) |
stream.Open Source, Mode, OpenOptions, UserName, Password | |
The Open method opens a Stream object from a URL, an opened Record object, or without a source at all, in memory. |
|
Arguments | |
|
|
Description | |
The Open method of the Stream object can be invoked with a URL source, an already opened Record object, or without a source at all, indicating that the Stream object is opened in memory. If this last method is used, you can read and write to the Stream object just as you can any other way, but you can persist and retrieve data only by using the SaveToFile or LoadFromFile methods. When opening a Stream object from an already opened Record object, the Mode value is taken from the Record object, and the UserName and Password properties, if specified, are ignored because access has to be already granted to the Record object if it is open. If opening a Stream from a Record object, specify the adOpenStreamFromRecord enumeration value as the OpenOptions argument, and ADO will use the Record's default stream to populate the Stream object. If you are opening the Stream object with a URL, you must use the URL keyword (URL=scheme://server/folder). |
|
See Also | |
ConnectModeEnum Enumeration, Stream.LoadFromFile Method, Stream.Mode Property, Stream.SaveToFile Method, StreamOpenOptionsEnum Enumeration |
|
Stream.Position Property | (Versions 2.5, 2.6) |
stream.Position = number | |
The Position property indicates the position of the stream pointer within the Stream object. |
|
Datatype | |
Long |
|
Description | |
The Position property can be set to any positive number or 0. It can also be set to a value greater than the size of the current Stream object. In doing so, for streams with write permissions you may increase the size of a Stream object by automatically adding Null values. You can, although you are not advised to, do the same for read-only streams, but the size is not altered. The Position property indicates the number of bytes the stream pointer is located away from the first byte in the stream. If your character set contains multiple bytes for each character, you must multiply this number by the position desired to get the actual character position. For example, when using Unicode, 0 represents the first character, and 2 represents the second. |
|
Stream.Read Method | (Versions 2.5, 2.6) |
bytes = stream.Read (NumBytes) | |
The Read method reads a number of bytes from a binary stream. |
|
Arguments | |
|
|
Returns | |
Variant (array) |
|
Description | |
The Read method is used to read binary streams (Stream.Type property is equal to adTypeBinary), while the ReadText method is used to read textual streams (Stream.Type property is equal to adTypeText). The return value is a Variant array of bytes, which will equal the number of bytes requested or the number of remaining bytes in the stream if the number of remaining bytes is less than the requested number of bytes. If there is no data to return, a Null Variant value is returned. |
|
See Also | |
Stream.ReadText Method, Stream.Type Property, StreamReadEnum Enumeration |
|
Stream.ReadText Method | (Versions 2.5, 2.6) |
string = stream.ReadText (NumChars) | |
The ReadText method reads a number of characters from a binary stream. |
|
Arguments | |
|
|
Returns | |
String |
|
Description | |
The ReadText method reads textual streams (Stream.Type property is equal to adTypeText), while the Read method is used to read binary streams (Stream.Type property is equal to adTypeBinary). The return value is a String of values, which equals the number of characters requested or the number of remaining characters in the stream if the number of remaining characters is less than the requested number of characters. If there is no data to return, a Null Variant value is returned. |
|
See Also | |
Stream.Read Method, Stream.Type Property, StreamReadEnum Enumeration |
|
Stream.SaveToFile Method | (Versions 2.5, 2.6) |
stream.SaveToFile (FileName, SaveOptions) | |
The SaveToFile method persists the data of a binary stream to a local file. |
|
Arguments | |
|
|
Description | |
The SaveToFile method completely overwrites an existing file if the adSaveCreateOverwrite enumeration value is used in the SaveOptions argument. Using this method does not change the contents of the Stream object nor its association to the original resource with which the Stream object was opened. The only difference from the Stream object is that the Position property is set to the beginning of the stream (0). |
|
See Also | |
SaveOptionsEnum Enumeration, Stream.Position Property |
|
Stream.SetEOS Method | (Versions 2.5, 2.6) |
stream.SetEOS | |
The SetEOS method changes the EOS within a given Stream object and truncates any data that lies past the new EOS pointer. |
|
Description | |
The SetEOS method can shorten a Stream object's length when using the Write, WriteText, and CopyTo methods, which cannot truncate the stream themselves. |
|
See Also | |
Stream.CopyTo Method, Stream.Write Method, Stream.WriteText Method |
|
Stream.Size Property | (Versions 2.5, 2.6) |
size = stream.Size | |
The Size property represents the number of bytes in a Stream object. |
|
Datatype | |
Long |
|
Description | |
Because the Stream object's size is only restricted by resources, a Long value may not correctly contain the size of a Stream if it exceeds the largest possible number a Long value can contain. If the size of a stream is unknown, -1 is returned. |
|
Stream.SkipLine Method | (Versions 2.5, 2.6) |
stream.SkipLine | |
The SkipLine method skips entire lines when reading text streams. |
|
Description | |
The SkipLine method skips an entire line in a textual stream (Stream.Type is equal to adTypeText). This is done by searching for the next occurrence of a line separator (indicated by the LineSeparator property which is, by default, set to adCRLF) or the EOS pointer. |
|
See Also | |
LineSeparatorEnum Enumeration, Stream.LineSeparator Property, Stream.Type Property |
|
Stream.State Property | (Versions 2.5, 2.6) |
state = record.State | |
The State property indicates the current state of the Stream object. |
|
Datatype | |
Long (ObjectStateEnum) |
|
Description | |
The State property is read-only; returning a Long value that can be evaluated as an ObjectStateEnum enumeration value. The default value for the Stream object is closed. For the Stream object, the State property can return multiple values when the object is executing an operation asynchronously (i.e., adStateOpen and adStateExecuting). |
|
See Also | |
ObjectStateEnum Enumeration |
|
Stream.Type Property | (Versions 2.5, 2.6) |
streamtype = stream.Type | |
The Type property indicates how a Stream object's data should be analyzed. |
|
Datatype | |
StreamTypeEnum Enumeration |
|
Description | |
The default value for a Stream object is adTypeText, but if binary data is written to a new Stream object, the Type property will automatically be changed to adTypeBinary. The Type property is read- and write-enabled while the stream pointer is at zero (Position property equals 0) and read-only at any other position. If the Type property is set to adTypeText, you should use the ReadText and WriteText methods for data manipulation and retrieval. If the Type property is set to adTypeBinary, you should use the Read and Write methods for data manipulation and retrieval. |
|
See Also | |
Stream.Read Method, Stream.ReadText Method, Stream.Write Method, Stream.WriteText method, StreamTypeEnum Enumeration |
|
Stream.Write Method | (Versions 2.5, 2.6) |
stream.Write Buffer | |
The Write method writes a number of bytes to a binary stream. |
|
Arguments | |
|
|
Description | |
After writing the specified bytes to the Stream object, the Position property is set to the next byte following the last byte written. If there is existing data past the end of what has been written, it is not truncated. If you want to truncate this data, call the SetEOS method. If the written data exceeds the length of the Stream object, the new data is appended to the Stream object, the length of the stream is increased, and the EOS pointer is moved to the new end of the stream. The Write method is used to write to binary streams (Stream.Type property is equal to adTypeBinary), while the WriteText method is used to write textual streams (Stream.Type property is equal to adTypeText). |
|
See Also | |
Stream.EOS Property, Stream.SetEOS Method, Stream.Type Property, Stream.WriteText Method, StreamWriteEnum Enumeration |
|
Stream.WriteText Method | (Versions 2.5, 2.6) |
stream.WriteText Data, Options | |
The WriteText method writes a number of bytes to a binary stream. |
|
Arguments | |
|
|
Description | |
After writing the specified string to the Stream object, the Position property is set to the next character following the last character written. If there is existing data past the end of what has been written, it is not truncated. If you want to truncate this data, call the SetEOS method. If the written data exceeds the length of the Stream object, the new data is appended to the Stream object, the length of the stream is increased, and the EOS pointer is moved to the new end of the stream. The WriteText method is used to write to text streams (Stream.Type property is equal to adTypeText), while the Write method is used to write binary streams (Stream.Type property is equal to adTypeBinary). |
|
See Also | |
Stream.EOS Property, Stream.SetEOS Method, Stream.Type Property, Stream.WriteText Method, StreamWriteEnum Enumeration |
|