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
trueif 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
CanWrite
When overridden in a derived class, gets a value indicating whether the current stream supports writing.
bool CanWrite { get; }
Property Value
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
resultchar[]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
resultstringWhen 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
encodingEncodingThe character encoding to use. If null, UTF-8 will be used.
resultchar[]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
encodingEncodingThe character encoding to use. If null, UTF-8 will be used.
resultstringWhen 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
encodingEncodingThe character encoding to use. If null, UTF-8 will be used.
resultStringBuilderWhen 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
resultStringBuilderWhen 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
newBufferbyte[]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
newBufferchar[]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
newBufferchar[]The new character array content. If null, the stream will be cleared.
encodingEncodingThe 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
newBufferstringThe 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
newBufferstringThe new string content. If null, the stream will be cleared.
encodingEncodingThe 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
newBufferStringBuilderThe 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
newBufferStringBuilderThe new StringBuilder content. If null, the stream will be cleared.
encodingEncodingThe 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
bufferbyte[]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
bufferchar[]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
bufferchar[]The character array to write. If null, no data is written.
encodingEncodingThe 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
bufferstringThe 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
bufferstringThe string to write. If null, no data is written.
encodingEncodingThe 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
bufferStringBuilderThe 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
bufferStringBuilderThe StringBuilder to write. If null, no data is written.
encodingEncodingThe character encoding to use. If null, UTF-8 will be used.