Skip to main content

Defining Stream Properties

Defining Stream Properties

InterSystems IRIS supports both binary streams and character streams. Binary streams contain the same sort of data as type %BinaryOpens in a new tab, and are intended for very large binary objects such as pictures. Similarly, character streams contain the same sort of data as type %StringOpens in a new tab, and are intended for storing large amounts of text. Character streams, like strings, may undergo a Unicode translation within client applications.

Stream data may be stored in an external file or an InterSystems IRIS global (or not at all), depending on how the stream property is defined:

The first four classes can use the optional LOCATION parameter to specify a default storage location.

In the following example, the JournalEntry class contains four stream properties (one for each of the first four stream classes), and specifies a default storage location for two of them:

Class testPkg.JournalEntry Extends %Persistent
{
Property DailyText As %Stream.FileCharacter;

Property DailyImage As %Stream.FileBinary(LOCATION = "C:/Images");

Property Text As %Stream.GlobalCharacter(LOCATION = "^MyText");

Property Picture As %Stream.GlobalBinary;
}

In this example, data for DailyImage is stored in a file (with an automatically generated name) in the C:/Images directory, while the data for the Text property is stored in a global named ^MyText.

FeedbackOpens in a new tab