CharStream

abstract class CharStream : StreamBase

Abstract base class for char streams, using UTF-16 code units.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val canUndo: Boolean
Link copied to clipboard
open override val dataType: DataType
Link copied to clipboard
open override val typeCode: Int

Functions

Link copied to clipboard
open fun copyTo(target: CharStream)
open fun copyTo(target: CharStream, closeTarget: Boolean)

Copy all remaining text until the end of this stream into a target stream, then close this stream. Also propagate the {@link com.sap.cloud.mobile.kotlin.odata.CharStream#entityTag CharStream.entityTag} and {@link com.sap.cloud.mobile.kotlin.odata.CharStream#mediaType CharStream.mediaType} of this stream into the target stream.

Link copied to clipboard
open fun copyToFile(file: String)

Copy all remaining text until the end of this stream into a file, then close this stream.

Link copied to clipboard
open fun readAndClose(): String

Read all remaining text until the end of this stream, then close this stream. Caution: this function loads all stream content into memory at once. Consider reading a chunk-at-a-time in a loop, using {@link com.sap.cloud.mobile.kotlin.odata.CharStream#readString(kotlin.Int) CharStream.readString}.

Link copied to clipboard
open fun readChar(): Int

Read a single character (UTF-16 code unit) from this stream.

Link copied to clipboard
open fun readLine(): String?

Read a line of text content from the stream.

Link copied to clipboard
open fun readString(): String?
open fun readString(length: Int): String?

Read up to length characters from this stream (may read less, even if the end of stream is not reached).

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.CharStream#dataType CharStream.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).

Link copied to clipboard
open fun undoRead(value: Char)

Undo read of one character.

Throws:

{@link com.sap.cloud.mobile.kotlin.odata.DataStreamException} if undo is not supported by this stream.

Link copied to clipboard
open fun withType(type: String?): CharStream

Fluent API to set the {@link com.sap.cloud.mobile.kotlin.odata.CharStream#mediaType CharStream.mediaType} for this stream.

Link copied to clipboard
open fun withUndo(): CharStream

Return a wrapper (if needed) of this stream supporting {@link com.sap.cloud.mobile.kotlin.odata.CharStream#undoRead(kotlin.Char) CharStream.undoRead}, or this stream if it already supports undoRead.

See Also:

{@link com.sap.cloud.mobile.kotlin.odata.CharStream#canUndo CharStream.canUndo}.

Link copied to clipboard
open fun writeChar(value: Char)

Write a single character to this stream.

Link copied to clipboard
open fun writeLine(text: String)

Write line content to the stream, followed by a newline character.

Link copied to clipboard
open fun writeString(text: String)

Write to this stream the portion of text from the specified offset with the specified length.