Public Member Functions | |
_.Library.Status | OnClose () |
This callback method is invoked by the <METHOD>Close</METHOD> method to. More... | |
_.Library.Integer | FileBinarySize () |
Return the current size of the file in bytes. | |
_.Library.Status | Flush () |
Flush any output in the stream not already saved. | |
_.Library.Status | LinkToFile (_.Library.String filename) |
This method lets you connect a file stream to a file called filename without. More... | |
_.Library.Status | MoveToEnd () |
Move to the end of the stream so the next <METHDO>Write</METHOD> will be appended to the end. More... | |
_.Library.Status | OutputToDevice (_.Library.Integer len) |
Write out len characters of the stream to the current device starting from the current position. More... | |
_.Library.RawString | Read (_.Library.Integer len, _.Library.Status sc) |
Reads up to len characters from the current position. More... | |
_.Library.RawString | ReadLine (_.Library.Integer len, _.Library.Status sc, _.Library.Boolean eol, _.Library.String term) |
Read a line from the file. More... | |
_.Library.Status | Rewind () |
Go back to the start of the stream. | |
_.Library.Integer | SizeGet () |
Return the current size of the data stream. | |
_.Library.Status | Write (_.Library.RawString data) |
Appends the string data to the stream and advances the. More... | |
_.Library.Status | WriteLine (_.Library.RawString data) |
Appends the string data along with a line terminator to the stream and advances the. More... | |
![]() | |
_.Library.Status | AcquireLock (locktype) |
Acquires a lock for the current instance. More... | |
_.Library.Status | OnAfterSave (_.Library.Boolean insert) |
This callback method is invoked by the <METHOD>Save</METHOD> method to. More... | |
_.Library.Status | OnBeforeSave (_.Library.Boolean insert) |
This callback method is invoked by the <METHOD>Save</METHOD> method to. More... | |
_.Library.Status | OnOpen () |
This callback method is invoked by the <METHOD>Open</METHOD> method to. More... | |
_.Library.Status | OnReload () |
This callback method is invoked by the <METHOD>Reload</METHOD> method to. More... | |
_.Library.Status | OnRollBack () |
This callback method is invoked by the <METHOD>Save</METHOD> method to. More... | |
_.Library.Status | Clear () |
Clear the contents of this Stream from permanent storage. More... | |
_.Library.Status | CopyFrom (_.Stream.Object source) |
Copies the contents of source into this Stream. More... | |
_.Library.Status | CopyFromAndSave (_.Stream.Object source) |
Copy the stream from source into the current stream ignoring anything already in the current stream. More... | |
_.Library.Integer | FindAt (_.Library.Integer position, _.Library.RawString target, _.Library.RawString tmpstr, _.Library.Boolean caseinsensitive) |
Find the first occurrence of target in the stream, starting the search at position. More... | |
_.Library.String | GetStreamId () |
Returns an full id value (including class name) with which the Stream implementation has stored. More... | |
_.Library.Status | InputFromDevice (_.Library.Integer len, _.Library.Integer timeout) |
Input len characters from the current device into the stream. More... | |
_.Library.Boolean | MoveTo (_.Library.Integer position) |
Move to this position in the stream. More... | |
_.Library.Status | OutputToDeviceAt (_.Library.Integer position, _.Library.Integer length) |
Output the stream to the current device starting at position of length. More... | |
_.Library.RawString | ReadLine (_.Library.Integer len, _.Library.Status sc, _.Library.Boolean eol) |
Read a line from the stream. More... | |
_.Library.String | ReadSQL (_.Library.Integer start, _.Library.Integer end) |
SQL specific method for reading stream data. | |
_.Library.Status | SerializeToSyncSet (_.SYNC.SyncSet ss, _.Library.Integer iPtr, _.Library.String property) |
SerializeToSyncSet copies the stream value from the current object to the sync set global. More... | |
_.Library.Status | SyncStreamIn (_.SYNC.SyncSet ss, _.Library.Integer iPtr, _.Library.String property) |
SyncStreamIn copies the stream value from the sync set global into the current object. | |
![]() | |
_.Library.Status | OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount) |
This callback method is invoked when the current object is added to the SaveSet,. More... | |
_.Library.Status | OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned) |
This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More... | |
_.Library.Status | OnNew () |
This callback method is invoked by the <METHOD>New</METHOD> method to. More... | |
_.Library.Status | OnValidateObject () |
This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More... | |
Static Public Member Functions | |
_.Library.String | DefaultStreamDir (_.Library.Boolean skip) |
Return the default directory to use for streams if none specified. | |
![]() | |
_.Library.String | GetLockReference (_.Library.String pLocation, _.Library.String pId) |
Returns the global reference used to lock the current stream object. More... | |
_.Library.Status | OnDelete (_.Library.ObjectIdentity oid) |
This callback method is invoked by the <METHOD>Delete</METHOD> method to. More... | |
_.Library.String | IsCharacter () |
Return true if this is a character stream and false if it is a binary stream. | |
_.Library.Boolean | StreamOIDIsNull (_.Library.ObjectIdentity soid) |
Return true if this stream oid is a null stream and false if the stream is not null. | |
Public Attributes | |
CanonicalFilename | |
Read only property that returns the canonical filename if the file is open and "" if the file is not open. More... | |
Filename | |
The filename that this stream is currently using. More... | |
LineTerminator | |
For file streams the line will terminate on any of the characters set in the LineTerminator, it does not support. More... | |
ReadSize | |
While reading this holds the file size. More... | |
RemoveOnClose | |
If true then remove the permanent file as well as any temp file when this object is closed. More... | |
![]() | |
AtEnd | |
The AtEnd property is set to true (1) when, during a read,. More... | |
Id | |
Id is the unique identifier for a stream within the Location. More... | |
LastModified | |
LastModified is a read-only property containing the <class>TimeStamp</class> of More... | |
Size | |
Size is a read-only property containing the current size of the stream (in bytes More... | |
Private Member Functions | |
_.Library.Integer | IsModified () |
Returns true (1) if a property of this instance has been modified, otherwise false (0). More... | |
_.Library.Boolean | IsNull () |
Returns true if this is a "NULL" stream; that is, a stream which has never. More... | |
_.Library.Status | LocationSet (_.Library.String dir) |
Note that setting the <property>Location</property> will cause a few things to happen. More... | |
_.Library.Status | NormalizeObject () |
Normalizes all of an object's property values by invoking the data type Normalize methods. More... | |
_.Library.Integer | ObjectModified () |
This method is somewhat similar to IsModified but it also checks to see if swizzled. More... | |
Static Private Member Functions | |
_.Library.Boolean | Exists (_.Library.ObjectIdentity soid) |
Checks to see if the object identified by the OID oid exists in the extent. More... | |
_.Library.Boolean | ObjectIsNull (_.Library.ObjectIdentity soid) |
Return true if this stream oid is a null stream and false if the stream is not null. | |
Private Attributes | |
__CurrFile | |
Full path name of currently opened file. More... | |
__MakePermLoc | |
If true then when saving this file we need to move it to the default permanent location. More... | |
__Mode | |
More... | |
__NormalizedDirectory | |
Normalized form of the directory. More... | |
__ReadMode | |
Mode the device is opened in, either with terminators as delimitors or not. More... | |
__TempFile | |
Name of file (without directory) containing temporary stream. More... | |
Additional Inherited Members | |
![]() | |
DEFAULTCONCURRENCY = None | |
![]() | |
CAPTION = None | |
Optional name used by the Form Wizard for a class when generating forms. More... | |
JAVATYPE = None | |
The Java type to be used when exported. | |
PROPERTYVALIDATION = None | |
This parameter controls the default validation behavior for the object. More... | |
For information on this class, see Working with Streams.
Stream class that stores binary data in files. For example, the following code opens a file binary stream, points it at a particular file on the filesystem, and then reads it in chunks of 32,000 bytes:
Set stream=##class(Stream.FileBinary).New() Set sc=stream.LinkToFile("c:\myfile.txt") While 'stream.AtEnd { Set line=stream.Read() ; Process the chunk here }
|
staticprivate |
Checks to see if the object identified by the OID oid exists in the extent.
<p>Returns <CLASS>%Boolean</CLASS> TRUE is it exists, FALSE if it does not.
Reimplemented from Object.
|
private |
Returns true (1) if a property of this instance has been modified, otherwise false (0).
A TRUE result does not necessarily mean that any property has actually been changed. If IsModified() returns false then the object has not been modified. There are some situations where we simply cannot efficiently detect a change in value. In these cases we will set the modified status of the property.
Reimplemented from RegisteredObject.
Reimplemented in FileCharacter.
|
private |
Returns true if this is a "NULL" stream; that is, a stream which has never.
been written to and saved and has no stream attributes. This is used by the InterSystems IRIS ODBC server.
Reimplemented from Object.
|
private |
Note that setting the <property>Location</property> will cause a few things to happen.
It will delete any temporary file that may have been created. It will not touch any permanent file that this object was associated with, if you wish to delete this pre-existing permanent file then call <method>Clear</method> passing '1' as the argument before setting the Location. It then marks this object as pointing to a null stream in the new directory you specified.
Reimplemented from Object.
|
private |
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 <em>normalized</em>, form.
Reimplemented from RegisteredObject.
|
private |
This method is somewhat similar to IsModified but it also checks to see if swizzled.
references would cause the object to become modified should they be serialized. This works on the assumption that a reference to a persistent object will never be modified if the ID has already been assigned. For references to serial objects, a call to ObjectModified indicates whether or not the serialized value is different. If the reference to a swizzled object is different from the initial object state then the $$$objModAll macro will already return true. Reference the <property>Set code.
Returns true (1) if this instance has been modified, otherwise false (0).
Reimplemented from RegisteredObject.
Reimplemented in FileCharacter.
_.Library.Status OnClose | ( | ) |
This callback method is invoked by the <METHOD>Close</METHOD> method to.
provide notification that the current object is being closed.
The return value of this method is ignored.
Reimplemented from Object.
_.Library.Status LinkToFile | ( | _.Library.String | filename | ) |
This method lets you connect a file stream to a file called filename without.
making a copy of it. If the file does not already exist it will still allow you to link to this file, and IsNull() will return true until you write to this file.
Do object.Image.LinkToFile("\temp\image.jpg") Do object.Save()
The method as its name suggests creates a LINK to an EXISTING file. So this is a 'shared public' file, as it can be shared by several instances of a class, or even several classes. Using the <method>CopyFrom</method> method, on the contrary, creates a 'private' image, not sharable by other instances/classes, so these two methods are really different.
The problems with shared public images are that several instances are all allowed to update and even delete the image, causing problems for other instances.
For example, if dog #2 has image 'test.gif', I can also assign that image to dog #5 or even person #24 If I change the image for dog #5, then the image is changed in place to another image, thus upsetting dog#2 and person#24. If I delete dog#5, the image is also deleted and thus dog#2 and person#24 are changed.
Also note that if there is currently some temporary data in the old stream when the <method>LinkToFile</method> is called this temporary data will be removed before the stream is linked to this filename.
_.Library.Status MoveToEnd | ( | ) |
Move to the end of the stream so the next <METHDO>Write</METHOD> will be appended to the end.
This allows you to read from a stream, then MoveToEnd() and append new data, where just calling <METHOD>Write</METHOD> after a read will clear the stream before writing new data.
Returns a <CLASS>Status</CLASS> value indicating success or failure.
Reimplemented from Object.
_.Library.Status OutputToDevice | ( | _.Library.Integer | len | ) |
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.
Reimplemented from Object.
_.Library.RawString Read | ( | _.Library.Integer | len, |
_.Library.Status | sc | ||
) |
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 <method>Read</method> will return a null string (""). If no len is passed in, ie. '<method>Read</method>()' then it is up to the Read implementation as to how much data to return. Some stream classes use this to optimize the amount of data returned to align this with the underlying storage of the stream.
You must call <method>Rewind</method> if you want to read a stream from the beginning again. Calling <method>Read</method> after <method>Write</method> implicitly ends the <method>Write</method> 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.
Reimplemented from Object.
_.Library.RawString ReadLine | ( | _.Library.Integer | len, |
_.Library.Status | sc, | ||
_.Library.Boolean | eol, | ||
_.Library.String | term | ||
) |
Read a line from the file.
Note that besides the normal ReadLine arguments this can also be passed a term which
will return the terminator that completed the line if we read in a whole line.
_.Library.Status Write | ( | _.Library.RawString | data | ) |
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 <CLASS>Status</CLASS> value indicating success or failure.
Reimplemented from Object.
_.Library.Status WriteLine | ( | _.Library.RawString | data | ) |
Appends the string data along with a line terminator to the stream and advances the.
current stream position by the number of characters in data plus the line terminator.
Returns a <CLASS>Status</CLASS> value indicating success or failure.
Reimplemented from Object.
CanonicalFilename |
Read only property that returns the canonical filename if the file is open and "" if the file is not open.
|
private |
Full path name of currently opened file.
Equal to "" if no file is open.
Filename |
The filename that this stream is currently using.
If you set this property to update the file we will write to/read from this operation can fail if for example the directory specified does not exist. To detect this failure either check the Status return code of the <method>FilenameSet</method> or if using 'Set stream.Filename=newname' then check objlasterror after the call to see if it reported an error.
LineTerminator |
For file streams the line will terminate on any of the characters set in the LineTerminator, it does not support.
multi-character line terminators because it uses the ObjectScript file behavior which terminates on any of the characters.
Also for FileCharacterStream even if you set this when you call <method>WriteLine</method> as the file was opened in 'S' mode it will normalize the line terminator as the data is being written, so for example if you set LineTerminator to $char(13,10) on Unix systems when you call <method>WriteLine</method> it will only write $char(10) to the file.
|
private |
If true then when saving this file we need to move it to the default permanent location.
|
private |
|
private |
Normalized form of the directory.
This is used for access to the file (as it adds the
extra '/' if needed), but it stores the <Property>Location</Property> in the Id as this may be a relative path.
|
private |
Mode the device is opened in, either with terminators as delimitors or not.
ReadSize |
While reading this holds the file size.
RemoveOnClose |
If true then remove the permanent file as well as any temp file when this object is closed.
If you call Save on a stream where RemoveOnClose is true it will set this to false as if you explicitly save the stream you no longer want it to be removed when the object is closed. In order to make sure Save always runs the logic to reset the flag setting this to true causes IsModified/ObjectModified to return true.
|
private |
Name of file (without directory) containing temporary stream.