DeltaStream
open class DeltaStream : DataValue
A stream of delta items, each of which is either an EntityValue
or a ChangedLink
.
While processing a stream, a delta link may be encountered, but it will not be immediately available to the caller. The deltaLink
can be obtained only after the stream is closed.
Example
let deltaStream = ...
while (deltaStream.next())
{
if (deltaStream.hasEntity())
{
let entity = deltaStream.getEntity()
// Process entity value.
}
else
{
let link = deltaStream.getLink()
// Process changed link.
}
}
deltaStream.close()
var deltaLink = deltaStream.deltaLink
// Save delta link for later use.
-
Has
close
been called?Declaration
Swift
final public var isClosed: Bool
-
The current delta item (an
EntityValue
orChangedLink
), ornil
.Declaration
Swift
final public var deltaItem: AnyObject?
-
The delta-link (if any) that was encountered when
next
was called repeatedly until it returnedfalse
and thenclose
was called, otherwisenil
.Declaration
Swift
final public var deltaLink: String?
-
The next-link (if any) that was encountered when
next
was called repeatedly until it returnedfalse
and thenclose
was called, otherwisenil
.Declaration
Swift
final public var nextLink: String?
-
The read-link (if any) that was encountered when
next
was called repeatedly until it returnedfalse
and thenclose
was called, otherwisenil
.Declaration
Swift
final public var readLink: String?
-
Default initializer.
Declaration
Swift
override public init()
-
Close this stream and release all associated resources, without checking first that the end of stream has been reached.
See also
close
.Declaration
Swift
open func abort() throws
-
Close this stream and release all associated resources, checking first that the end of stream has been reached. Can safely be called even if the stream was previously closed. If a delta link was encountered before the stream was closed, it will be available via the
deltaLink
property only after the stream is closed. If a next link was encountered before the stream was closed, it will be available via thenextLink
property only after the stream is closed.See also
abort
.Declaration
Swift
open func close() throws
-
See also
hasCurrent
.Declaration
Swift
open func current() throws -> AnyObject?
Return Value
the current delta item (an
EntityValue
orChangedLink
), ornil
if there is no current delta item. -
Data type with a
DataType.code
ofDataType.DELTA_STREAM
.Declaration
Swift
override open var dataType: DataType { get }
-
Throws
UsageException
if there no current delta item or if the current delta item is a changed link.See also
getCurrent
.Declaration
Swift
open func entity() throws -> EntityValue
Return Value
the current entity value.
-
See also
getCurrent
.Declaration
Swift
open func hasCurrent() throws -> Bool
Return Value
true
if the if the stream has a current delta item (the most recent call tonext
returnedtrue
andclose
has not been called)). -
Check if the stream has a current delta item which is an entity value.
See also
getEntity
.Declaration
Swift
open func hasEntity() throws -> Bool
Return Value
true
ifhasCurrent
would returntrue
if called, and the current delta item is an entity value. -
Check if the stream has a current delta item which is a changed link.
See also
getLink
.Declaration
Swift
open func hasLink() throws -> Bool
Return Value
true
ifhasCurrent
would returntrue
if called, and the current delta item is a changed link. -
Throws
UsageException
if there is no current delta item or if the current delta item is an entity value.See also
getCurrent
.Declaration
Swift
open func link() throws -> ChangedLink
Return Value
the current changed link.
-
If this stream has not been
close
and has a next delta item, then advance to the next delta item and returntrue
. Otherwise returnfalse
.See also
hasCurrent
,hasEntity
,hasLink
,getCurrent
,getEntity
,getLink
.Declaration
Swift
open func next() throws -> Bool
Return Value
true
if there is a next delta item available. -
Convert this data value to a string. If the
dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used. JSON format is used for structured values (arrays and objects).Declaration
Swift
override open func toString() -> String
Return Value
Lexical representation of this data value.