Table of Contents

Interface IStream

Namespace
Cobilas.GodotEngine.Utility.IO.Interfaces
Assembly
com.cobilas.godot.utility.dll

Represents a generic stream interface for reading from and writing to different data sources.

public interface IStream : IDisposable
Inherited Members

Properties

AutoFlush

Gets or sets a value indicating whether the stream should automatically flush after each write operation.

bool AutoFlush { get; set; }

Property Value

bool

true if auto-flush is enabled; otherwise, false.

CanRead

When overridden in a derived class, gets a value indicating whether the current stream supports reading.

bool CanRead { get; }

Property Value

bool

true if the stream supports reading; otherwise, false.

CanWrite

When overridden in a derived class, gets a value indicating whether the current stream supports writing.

bool CanWrite { get; }

Property Value

bool

true if the stream supports writing; otherwise, false.

Methods

Flush()

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

void Flush()

Exceptions

IOException

An I/O error occurs.

Read()

Reads all bytes from the stream.

byte[] Read()

Returns

byte[]

A byte array containing the data read from the stream.

Read(out char[])

Reads the stream content as a character array using UTF-8 encoding.

void Read(out char[] result)

Parameters

result char[]

When this method returns, contains the character array representation of the stream content.

Read(out string)

Reads the stream content as a string using UTF-8 encoding.

void Read(out string result)

Parameters

result string

When this method returns, contains the string representation of the stream content.

Read(Encoding?, out char[])

Reads the stream content as a character array using the specified encoding.

void Read(Encoding? encoding, out char[] result)

Parameters

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

result char[]

When this method returns, contains the character array representation of the stream content.

Read(Encoding?, out string)

Reads the stream content as a string using the specified encoding.

void Read(Encoding? encoding, out string result)

Parameters

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

result string

When this method returns, contains the string representation of the stream content.

Read(Encoding?, out StringBuilder)

Reads the stream content into a StringBuilder using the specified encoding.

void Read(Encoding? encoding, out StringBuilder result)

Parameters

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

result StringBuilder

When this method returns, contains the StringBuilder with the stream content.

Read(out StringBuilder)

Reads the stream content into a StringBuilder using UTF-8 encoding.

void Read(out StringBuilder result)

Parameters

result StringBuilder

When this method returns, contains the StringBuilder with the stream content.

ReplaceBuffer(byte[]?)

Replaces the entire stream content with the specified byte array.

void ReplaceBuffer(byte[]? newBuffer)

Parameters

newBuffer byte[]

The new byte array content. If null, the stream will be cleared.

ReplaceBuffer(char[]?)

Replaces the entire stream content with a character array using UTF-8 encoding.

void ReplaceBuffer(char[]? newBuffer)

Parameters

newBuffer char[]

The new character array content. If null, the stream will be cleared.

ReplaceBuffer(char[]?, Encoding?)

Replaces the entire stream content with a character array using the specified encoding.

void ReplaceBuffer(char[]? newBuffer, Encoding? encoding)

Parameters

newBuffer char[]

The new character array content. If null, the stream will be cleared.

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

ReplaceBuffer(string?)

Replaces the entire stream content with a string using UTF-8 encoding.

void ReplaceBuffer(string? newBuffer)

Parameters

newBuffer string

The new string content. If null, the stream will be cleared.

ReplaceBuffer(string?, Encoding?)

Replaces the entire stream content with a string using the specified encoding.

void ReplaceBuffer(string? newBuffer, Encoding? encoding)

Parameters

newBuffer string

The new string content. If null, the stream will be cleared.

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

ReplaceBuffer(StringBuilder?)

Replaces the entire stream content with a StringBuilder using UTF-8 encoding.

void ReplaceBuffer(StringBuilder? newBuffer)

Parameters

newBuffer StringBuilder

The new StringBuilder content. If null, the stream will be cleared.

ReplaceBuffer(StringBuilder?, Encoding?)

Replaces the entire stream content with a StringBuilder using the specified encoding.

void ReplaceBuffer(StringBuilder? newBuffer, Encoding? encoding)

Parameters

newBuffer StringBuilder

The new StringBuilder content. If null, the stream will be cleared.

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

Write(byte[]?)

Writes a sequence of bytes to the stream.

void Write(byte[]? buffer)

Parameters

buffer byte[]

The byte array to write. If null, no data is written.

Write(char[]?)

Writes a character array to the stream using UTF-8 encoding.

void Write(char[]? buffer)

Parameters

buffer char[]

The character array to write. If null, no data is written.

Write(char[]?, Encoding?)

Writes a character array to the stream using the specified encoding.

void Write(char[]? buffer, Encoding? encoding)

Parameters

buffer char[]

The character array to write. If null, no data is written.

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

Write(string?)

Writes a string to the stream using UTF-8 encoding.

void Write(string? buffer)

Parameters

buffer string

The string to write. If null, no data is written.

Write(string?, Encoding?)

Writes a string to the stream using the specified encoding.

void Write(string? buffer, Encoding? encoding)

Parameters

buffer string

The string to write. If null, no data is written.

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.

Write(StringBuilder?)

Writes a StringBuilder to the stream using UTF-8 encoding.

void Write(StringBuilder? buffer)

Parameters

buffer StringBuilder

The StringBuilder to write. If null, no data is written.

Write(StringBuilder?, Encoding?)

Writes a StringBuilder to the stream using the specified encoding.

void Write(StringBuilder? buffer, Encoding? encoding)

Parameters

buffer StringBuilder

The StringBuilder to write. If null, no data is written.

encoding Encoding

The character encoding to use. If null, UTF-8 will be used.