Class Reference
%Library.GlobalStreamAdaptor
Server:basexml
Instance:SOAXML
User:UnknownUser
 
-
Private  Storage

abstract stream class %Library.GlobalStreamAdaptor extends %AbstractStream

Stream adaptor for streams that store data in global nodes. Not to be used directly.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
3 35


Summary

Properties
%Location AtEnd Attributes Id LastModified
LineTerminator Size

Methods
%%OIDGet %AddToSaveSet %CheckUnique %ClassIsLatestVersion
%ClassName %ConstructClone %Delete %DeleteExtent
%DeleteId %DispatchClassMethod %DispatchGetModified %DispatchGetProperty
%DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty
%Exists %ExistsId %Extends %GetParameter
%GetSwizzleObject %Id %IsA %IsModified
%KillExtent %LocationGet %LocationSet %LockStream
%New %NormalizeObject %ObjectModified %Oid
%Open %OpenId %OriginalNamespace %PackageName
%ReleaseLock %Reload %RemoveFromSaveSet %RollBack
%Save %SerializeObject %SetModified %UnlockStream
%ValidateObject Clear CopyFrom CopyFromAndSave
DeleteAttribute DeleteStream FindAt Flush
GetAttribute GetStreamId GlobalFromSid InputFromDevice
IsCharacter IsDefinedAttribute IsNull LastModifiedGet
LineTerminatorSet MoveTo MoveToEnd NextAttribute
OpenStream OutputToDevice OutputToDeviceAt Read
ReadLine ReadLineIntoStream ReadSQL Rewind
SaveStream SerializeToSyncSet SetAttribute SizeGet
StreamOIDIsNull SyncStreamIn Write WriteLine

Subclasses
%Library.GlobalBinaryStream %Library.GlobalCharacterStream

Parameters

• parameter BUFFERLEN = 32656;
Number of characters that we are storing in each global node
• parameter STORAGE = "GLOBAL";
• parameter STOREGLOBALNAME = "^CacheStream";
Default location: can be overridden at run-time

Methods

• classmethod %Exists(soid As %ObjectIdentity) as %Boolean
Checks to see if the object identified by the OID oid exists in the extent.

Returns %Boolean TRUE is it exists, FALSE if it does not.

• method %LocationGet() as %String
This is a Get accessor method for the %Location property.
• method %LocationSet(value As %String) as %Status
This is a Set accessor method for the %Location property.
• method %LockStream()
%LockStream() Obtain a shared lock on the current stream object. The return value is 1 if the stream was already locked or if it was successfully locked. If the stream cannot be locked the return value is 0. This version of %LockStream differs from %Stream.Object only in the arguments passed to %GetLockReference.
• method %NormalizeObject() as %Status
Normalizes all of an object's property values by invoking the data type Normalize methods. Many data types may allow many different representations of the same value. Normalization converts a value to its cannonical, or normalized, form.
• method %ValidateObject(force As %Integer = 0) as %Status
This method validates an object. The %Save method of a persistent class calls it before filing any objects in the database. The %ValidateObject method of a referencing object can call it. You can also call it explicitly at any time.

%ValidateObject does the following:

  1. It tests if any required property values are missing.
  2. If the PROPERTYVALIDATION class parameter is set to ValidateOnSave, it validates each non-null property value by calling the property method IsValid on each literal property and the object's %ValidateObject method for object-valued properties.
  3. If present, it will call a user-supplied %OnValidateObject method.

If any of these tests fail, %ValidateObject immediately returns an error value. It is up to the caller of %ValidateObject to process the error value.

Returns a %Status value indicating success or failure.

• method Clear(permanent As %Boolean = 1) as %Status
Clear the contents of this Stream from permanent storage. This will remove the permanent stream storage and any temporary stream and initialise the stream to its initial state that it starts in, including removing all the stream attributes.

Returns a %Status value indicating success or failure.

• method CopyFrom(source As %AbstractStream) as %Status
Copies the contents of source into this Stream.

For example, you can copy oldstream into a new stream:

	Set newstream=##class(%GlobalCharacterStream).%New()
	Do newstream.CopyFrom(oldstream)

Returns a %Status value indicating success or failure.

• method Flush() as %Status
Flush any output in the stream not already saved.
• classmethod GlobalFromSid(sid As %String) as %String
Given a stream id this returns the root global node where this stream is stored
• method LastModifiedGet() as %TimeStamp
This is a Get accessor method for the LastModified property.
• method MoveToEnd() as %Status
Move to the end of the stream so the next Write will be appended to the end. This allows you to read from a stream, then MoveToEnd() and append new data, where just calling Write after a read will clear the stream before writing new data.

Returns a %Status value indicating success or failure.

• method OpenStream(sid As %String) as %Status
• method OutputToDevice(ByRef len As %Integer = -1) as %Status
Write out len characters of the stream to the current device starting from the current position. This method is optimised for performance by the various sub classes. If len is omitted or set to -1 then it will write out the entire stream starting at the beginning.
• method Read(ByRef len As %Integer = 32000, ByRef sc As %Status) as %CacheString
Reads up to len characters from the current position in the stream. The current position is advanced by the number of characters read. Upon exit, len is set to the actual number of characters read. If a read occurs when the stream position is at the end of the stream, len will be set to -1 and Read will return a null string ("").

You must call Rewind if you want to read a stream from the beginning again. Calling Read after Write implicitly ends the Write operation and rewinds to the start of the stream.

Returns a string up to len characters long. The byref argument sc will return a %Status if any error occurred during the read.

• method ReadLine(ByRef len As %Integer = 32000, ByRef sc As %Status, ByRef eol As %Boolean) as %CacheString
Read a line from the stream. This will look for the line terminator in the stream and once it finds the terminator it will return the string minus the terminator character/s. If it reaches the end of the stream before it finds a terminator it will return the data it has so far, and if you specify a maximum size in len it will only read up to this number of characters. On exit len will contain the actual number of characters read. The byref argument sc will return a %Status if any error occured during the read and the byref argument eol is true if it found the line terminator and false otherwise. So for example you can read in a stream a line at a time and output the results to the current device with:
	While 'stream.AtEnd { Write stream.ReadLine(,.sc,.eol) If $$$ISERR(sc) { Write "ERROR" Quit } If eol { Write ! } }
• method ReadLineIntoStream() as %AbstractStream
This reads from the stream until it find the LineTerminator and returns this as a stream. If the stream does not contain the line terminator this can potentially be the entire stream.
• method Rewind() as %Status
Go back to the start of the stream.
• method SaveStream() as %Status
Deprecated method, use %Save instead. Saves the temporary copy of the stream data to a persistent location. Note that any locking or transaction handling must be done by the caller.

Returns a %Status value indicating success or failure.

• method SizeGet() as %Integer
Return the current size of the data stream.
• classmethod StreamOIDIsNull(soid As %ObjectIdentity) as %Boolean
Return true if this stream oid is a null stream and false if the stream is not null
• method Write(data As %CacheString = "") as %Status
Appends the string data to the stream and advances the current stream position by the number of characters in data.

Note that a write operation immediately following a read or rewind will clear out the existing data in the stream.

Returns a %Status value indicating success or failure.