IRISLIB database
LibraryStream Class Reference

Adapts IO stream classes to provide a legacy Library.AbstractStream interface. More...

Inheritance diagram for LibraryStream:
Collaboration diagram for LibraryStream:

Public Member Functions

_.Library.Status Clear ()
 Clear the contents of this Stream from permanent storage. More...
 
_.Library.Status CopyFrom (_.Stream.Object source)
 Copy the contents of the given source IO, Library or Stream stream to the wrappered IO stream.
 
_.Library.Integer FindAt (_.Library.Integer position, _.Library.RawString target, _.Library.RawString tmpstr)
 Find the first occurrence of target in the stream starting the. More...
 
_.Library.Status Flush ()
 Flush any output in the stream not already saved.
 
_.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 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.Status OutputToDeviceAt (_.Library.Integer position, _.Library.Integer length)
 Output the stream to the current device starting at position of length. 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)
 Read a line from the stream. More...
 
_.Library.Status Rewind ()
 Go back to the start of the 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...
 
- Public Member Functions inherited from AbstractStream
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status CopyFrom (_.Stream.Object source)
 Copies the contents of source into this Stream. More...
 
_.Library.Boolean DeleteAttribute (_.Library.String name)
 Removes this attribute variable from the collection. More...
 
_.Library.String GetAttribute (_.Library.String name, _.Library.String default)
 Retrieves the named attribute value.
 
_.Library.String GetStreamId ()
 Returns an full id value (including class name) with which the Stream implementation has stored. More...
 
_.Library.Boolean IsDefinedAttribute (_.Library.String name)
 Returns true if the named attribute variable exists in the collection, false otherwise.
 
_.Library.Boolean IsNull ()
 Returns true if this is a "NULL" stream; that is, a stream which has never. More...
 
_.Library.String NextAttribute (_.Library.String name)
 Retrieves the next attribute variable name in the sequence, skip any '' names.
 
_.Library.AbstractStream ReadLineIntoStream ()
 This reads from the stream until it find the <property>LineTerminator</property> and returns. More...
 
_.Library.Status SaveStream ()
 Deprecated method, use <method>Save</method> instead. More...
 
 SetAttribute (_.Library.String name, _.Library.String value)
 Inserts an attribute variable by name into the collection.
 
_.Library.Status WriteLine (_.Library.RawString data)
 Appends the string data along with a line terminator to the stream and advances the. More...
 
- Public Member Functions inherited from Object
_.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 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 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.
 
- Public Member Functions inherited from RegisteredObject
_.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...
 

Public Attributes

 AtEnd
   More...
 
 IOStream
 The IO.I.Stream that we are wrapping. More...
 
 LastModified
   More...
 
 LineTerminator
   More...
 
 Size
   More...
 
- Public Attributes inherited from AbstractStream
 Attributes
 An array of strings containing any attribute values associated with this stream. More...
 
 LineTerminator
 Type of line terminator we use for this stream, defaults to Cr/Lf. More...
 
- Public Attributes inherited from Object
 AtEnd
 The AtEnd property is set to true (1) when, during a read,. 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractStream
_.Library.Status DeleteStream (_.Library.ObjectIdentity oid, _.Library.Integer concurrency)
 Deprecated method, use <method>Delete</method> instead. More...
 
- Static Public Member Functions inherited from Object
_.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.
 
- Static Public Attributes inherited from AbstractStream
 MAXLEN = None
 The maximum number of characters (or bytes) allowed in a stream.
 
 PROPERTYVALIDATION = None
 Turns off property validation.
 
- Static Public Attributes inherited from Object
 DEFAULTCONCURRENCY = None
 
- Static Public Attributes inherited from RegisteredObject
 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...
 

Detailed Description

Adapts IO stream classes to provide a legacy Library.AbstractStream interface.

Member Function Documentation

◆ Clear()

_.Library.Status Clear ( )

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 <CLASS>Status</CLASS> value indicating success or failure.

Reimplemented from Object.

◆ FindAt()

_.Library.Integer FindAt ( _.Library.Integer  position,
_.Library.RawString  target,
_.Library.RawString  tmpstr 
)

Find the first occurrence of target in the stream starting the.

search at position. It returns the position at this match starting at the beginning of the stream. If it does not find the target string then return -1. If position=-1 then start searching from the current location and just return the offset from the last search, useful for searching through the entire file. If you are doing this you should pass in tmpstr by reference in every call which is used as a temporary location to store information being read so the next call will start where the last one left off.

◆ InputFromDevice()

_.Library.Status InputFromDevice ( _.Library.Integer  len,
_.Library.Integer  timeout 
)

Input len characters from the current device into the stream.

This is equivalent to doing a series of

reads and calling <METHOD>Write</METHOD> for each of them but it may be optimised by the subclasses. On return len will be the number of characters still to read in (if no timeout has occured this should be 0).

Reimplemented from Object.

◆ MoveTo()

_.Library.Boolean MoveTo ( _.Library.Integer  position)

Move to this position in the stream.

If this suceeds then return

true, else return false. Note this implementation is not efficient because it searches from the start of the stream, it can be improved upon in specific subclasses. Note that moving to position 1 will be at the start of the stream, position 2 will be at the second character of the stream, etc.

Reimplemented from Object.

◆ MoveToEnd()

_.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 AbstractStream.

◆ OutputToDevice()

_.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.

◆ OutputToDeviceAt()

_.Library.Status OutputToDeviceAt ( _.Library.Integer  position,
_.Library.Integer  length 
)

Output the stream to the current device starting at position of length.

length. The length if passed by reference returns the number of characters output.

Reimplemented from Object.

◆ Read()

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.

◆ ReadLine()

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 <method>Status</method> 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 ! } }

Reimplemented from Object.

◆ Write()

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.

◆ WriteLine()

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.

Member Data Documentation

◆ AtEnd

AtEnd

 

 

◆ IOStream

IOStream

The IO.I.Stream that we are wrapping.

 

◆ LastModified

LastModified

 

 

◆ LineTerminator

LineTerminator

 

 

◆ Size

Size