%Stream.DynamicBinary character stream containing
the 8-bit binary bytes of
an element of a %DynamicAbstractObject. It is
particularly useful for
holding the value of a %DynamicAbstractObject element
with a byte stream
value that would exceed the capacity of an ObjectScript string variable.
A %Stream.DynamicBinary object is readonly and it
cannot be modified or saved.
But it can be copied to any other %Stream class object that does support
modification and saving.
One way to create a %Stream.DynamicBinary
is by making a method call that
looks like dao.%Get(key,default,"stream"), dao.%Get(key,default,"streambase64")
where dao is an object reference
to a subclass of %DynamicAbstractObject; and
where key is the key name
value of an element of a %DynamicObject or the index value of an
element of a %DynamicArray. You can also get a
%Stream.DynamicBinary object by calling the
%GetNext()(.key,.value,.type)
method in one of subclasses of the
%Iterator.AbstractIterator class.
method OutputToDevice(ByRef len As %Integer = -1) as %Status
Write out len bytes of the stream to the current device
starting from the current position. If len is omitted
or set to -1 then the OutputToDevice() method
will write out the entire stream starting at the beginning and then
rewind back to the beginning. If len > 0 and we are unable to
write len
bytes because we reach the end of the stream then we will stop writing
and set the AtEnd property to 1. Otherwise, we will leave
the stream positioned after the last byte written to the device.
If parameter len
is passed by reference and if no error occurs then the number of
bytes actually written to the output device will be assigned
to len.
If zero bytes are written because we are already positioned at the end
of the stream then len will be assigned to -1.
If an error occurs while writing the device then len will be assigned
to -2, an error %Status value will be returned and the stream
will rollback to its original position.
This reads from the stream until it finds the
LineTerminator and returns a new
%Stream.TmpCharacter
stream containing the bytes in the line. If the stream does not contain
the line terminator then this can potentially be the
entire stream.