Storages & Files Clone
Clone method

Returns a copy of the SFStream object controlling a clone of the same stream. The both copies are independent and positions changes in the one copy will not affect the other. However the method may return an error if the stream attached to it is unable to clone itself.


Set newObject = object.Clone




Dim sf,stg,strm,bin,strm2
Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set stg = sf.OpenStorageFile("c:\myfile.bin")
Set strm = stg.OpenStream("Mystream")
Set strm2 = strm.Clone
strm.Pos = 500
strm2.Pos = 1000
' Set different positions. Assume the following code contains some functions
' which receive a stream as parameter and they read from the passed stream
' expecting the stream passed as parameter to be positioned to the correct location


Cloning of a stream is not always possible. It depends on the type of stream (memory stream, File stream, Stream in OLE compound file) and depends also on the open/create flags. For example a file stream opened in exclusive mode will not be able to clone itself.

Applies to: SFStream object

See also: Flags

newObjects Copyright 2001-2006 newObjects [ ]