DeltaStream

abstract class DeltaStream : DataValue

A stream of delta items, each of which is either an {@link com.sap.cloud.mobile.kotlin.odata.EntityValue} or a {@link com.sap.cloud.mobile.kotlin.odata.ChangedLink}. While processing a stream, a delta link may be encountered, but it will not be immediately available to the caller. The {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#deltaLink DeltaStream.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.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val dataType: DataType
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun abort()

Close this stream and release all associated resources, without checking first that the end of stream has been reached.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#close() DeltaStream.close}.

Link copied to clipboard
open fun close()

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 {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#deltaLink DeltaStream.deltaLink} property only after the stream is closed. If a next link was encountered before the stream was closed, it will be available via the {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#nextLink DeltaStream.nextLink} property only after the stream is closed.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#abort() DeltaStream.abort}.

Link copied to clipboard
open fun getCurrent(): Any?

Return (nullable) the current delta item (an {@link com.sap.cloud.mobile.kotlin.odata.EntityValue} or {@link com.sap.cloud.mobile.kotlin.odata.ChangedLink}), or null if there is no current delta item.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#hasCurrent() DeltaStream.hasCurrent}.

Link copied to clipboard

Return the current entity value.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.core.UsageException} if there no current delta item or if the current delta item is a changed link.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getCurrent() DeltaStream.getCurrent}.

Link copied to clipboard
open fun getLink(): ChangedLink

Return the current changed link.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.core.UsageException} if there is no current delta item or if the current delta item is an entity value.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getCurrent() DeltaStream.getCurrent}.

Link copied to clipboard
open fun hasCurrent(): Boolean

Return true if the if the stream has a current delta item (the most recent call to {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#next() DeltaStream.next} returned true and {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#close() DeltaStream.close} has not been called)).

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getCurrent() DeltaStream.getCurrent}.

Link copied to clipboard
open fun hasEntity(): Boolean

Check if the stream has a current delta item which is an entity value.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getEntity() DeltaStream.getEntity}.

Link copied to clipboard
open fun hasLink(): Boolean

Check if the stream has a current delta item which is a changed link.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getLink() DeltaStream.getLink}.

Link copied to clipboard
abstract fun next(): Boolean

If this stream has not been {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#close() DeltaStream.close} and has a next delta item, then advance to the next delta item and return true. Otherwise return false.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#hasCurrent() DeltaStream.hasCurrent}, {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#hasEntity() DeltaStream.hasEntity}, {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#hasLink() DeltaStream.hasLink}, {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getCurrent() DeltaStream.getCurrent}, {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getEntity() DeltaStream.getEntity}, {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#getLink() DeltaStream.getLink}.

Link copied to clipboard
open override fun toString(): String

Convert this data value to a string. If the {@link com.sap.cloud.mobile.kotlin.odata.DeltaStream#dataType DeltaStream.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).