Home > Class Reference > ENSLIB namespace > %Stream.Object

%Stream.Object

abstract stream class %Stream.Object extends %Library.RegisteredObject

The %Stream.Object class provides the basic mechanism by which stream objects are stored to and retrieved from a database.

A stream represents an arbitrary array of characters (or bytes) and a current position. The basic stream interface provides the ability to read data from a stream, write data to the stream, and rewind the current position to the beginning of the stream.

Within Caché streams are used to create large (greater than 32K) object attributes.

Property Inventory (Including Private)

Method Inventory (Including Private)

Parameters

parameter DEFAULTCONCURRENCY = $zu(115,10);

Properties (Including Private)

property %Concurrency as %CacheString [ Private , InitialExpression = $zu(115,10) , Transient ];
Property methods: %ConcurrencyGet(), %ConcurrencyIsValid(), %ConcurrencySet()
property %Location as %String (MAXLEN = 1024);
%Location is place where stream data is stored. For global streams this will be a global reference. For file streams it may be a directory. This is not the location of this specific stream, but the root location of what may be multiple streams.
Property methods: %LocationDisplayToLogical(), %LocationGet(), %LocationIsValid(), %LocationLogicalToDisplay(), %LocationLogicalToOdbc(), %LocationNormalize(), %LocationSet()
property AtEnd as %Boolean [ InitialExpression = 1 ];
The AtEnd property is set to true (1) when, during a read, a stream has reached the end of its data source.
Property methods: AtEndDisplayToLogical(), AtEndGet(), AtEndIsValid(), AtEndLogicalToDisplay(), AtEndNormalize(), AtEndSet()
property Id as %String;
Id is the unique identifier for a stream within the %Location.
Property methods: IdDisplayToLogical(), IdGet(), IdIsValid(), IdLogicalToDisplay(), IdLogicalToOdbc(), IdNormalize(), IdSet()
property LastModified as %TimeStamp [ Calculated ];
LastModified is a read-only property containing the %TimeStamp of the last modification to this stream. If the stream is null then it will report "".
Property methods: LastModifiedDisplayToLogical(), LastModifiedGet(), LastModifiedIsValid(), LastModifiedLogicalToDisplay(), LastModifiedNormalize(), LastModifiedOdbcToLogical()
property Size as %Integer [ Calculated ];
Size is a read-only property containing the current size of the stream (in bytes for a binary stream and characters for a character stream).

If a specific stream implementation cannot determine the size of the stream then Size will be equal to -1.
VMS does not support moving to a position in a file or providing the current position in a file. On VMS if a BOM is included at the start of the file it may be included in the size calculated.

Property methods: SizeDisplayToLogical(), SizeGet(), SizeIsValid(), SizeLogicalToDisplay(), SizeNormalize()

Methods (Including Private)

private method %AcquireLock(locktype) as %Status
Acquires a lock for the current instance.

The locktype argument specifies the type of lock to acquire. It can take the following values:

"e": Exclusive An exclusive lock will prevent any other process from acquiring any type of lock on this object.
"s": Shared A shared lock will allow other processes to acquire shared locks but will prevent other processes from acquiring an exclusive lock.
Fails if the locktype parameter is not one of the values described above.

Returns a %Status value indicating success or failure.

classmethod %CheckUnique(idxlist As %List = "") as %Status
final classmethod %Delete(oid As %ObjectIdentity = "", concurrency As %Integer) as %Status
Deletes the stored version of the object with OID oid from the database. It does not remove any in-memory versions of the object that may be present. Refer to About Concurrency for more details on the optional concurrency argument.

Returns a %Status value indicating success or failure.

Internally, %Delete() initiates a transaction and then invokes the storage interface method %DeleteData(). If %DeleteData() succeeds, the transaction is committed, otherwise it is rolled back.

private classmethod %DeleteData(soid As %String, concurrency As %Integer) as %Status
classmethod %DeleteExtent(concurrency As %Integer, ByRef deletecount, ByRef instancecount) as %Status
Delete all instances of this class from its extent. On exit instancecount contains the original number of instances while deletecount contains the number of instances actually deleted.

Internally, %DeleteExtent() iterates over the set of instances in the collection and invokes the %Delete() method. Refer to About Concurrency for more details on the optional concurrency argument.

Returns a %Status value indicating success or failure.

final classmethod %DeleteId(id As %String, concurrency As %Integer) as %Status
Deletes the stored version of the object with ID id from the database.

%DeleteId() is identical in operation to the %Delete() method except that it uses and Id value instead of an OID value to find an object. Refer to About Concurrency for more details on the optional concurrency argument.

classmethod %Exists(soid As %ObjectIdentity) as