API Reference
RenderIO
Simple file and stream helpers for rendered assets.
Inheritance
- Object
- RenderIO
Methods
public static Byte[] ReadBinary(Stream stream) #Byte[]Reads binary data from a file.
Parameters
- path System.String
- Input file path.
Returns
Binary file contents.
public static Byte[] ReadBinary(Stream stream, Int32 maxBytes) #Byte[]Reads binary data from a file with a size limit.
Parameters
- path System.String
- Input file path.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
Returns
Binary file contents.
ReadBinary(System.IO.Stream stream) #Reads binary data from a stream.
Parameters
- stream System.IO.Stream
- Input stream.
Returns
Binary data.
ReadBinary(System.IO.Stream stream, System.Int32 maxBytes) #Reads binary data from a stream with a size limit.
Parameters
- stream System.IO.Stream
- Input stream.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
Returns
Binary data.
public static async Task<Byte[]> ReadBinaryAsync(Stream stream, CancellationToken cancellationToken = null) #Task<Byte[]>Reads binary data from a file asynchronously.
Parameters
- path System.String
- Input file path.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
Binary file contents.
public static async Task<Byte[]> ReadBinaryAsync(Stream stream, Int32 maxBytes, CancellationToken cancellationToken = null) #Task<Byte[]>Reads binary data from a file asynchronously with a size limit.
Parameters
- path System.String
- Input file path.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
Binary file contents.
ReadBinaryAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken) #Reads binary data from a stream asynchronously.
Parameters
- stream System.IO.Stream
- Input stream.
- cancellationToken System.Threading.CancellationToken
- Cancellation token.
Returns
Binary data.
ReadBinaryAsync(System.IO.Stream stream, System.Int32 maxBytes, System.Threading.CancellationToken cancellationToken) #Reads binary data from a stream asynchronously with a size limit.
Parameters
- stream System.IO.Stream
- Input stream.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
- cancellationToken System.Threading.CancellationToken
- Cancellation token.
Returns
Binary data.
public static String ReadText(Stream stream, Encoding encoding = null) #StringReads text from a file.
Parameters
- path System.String
- Input file path.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
Returns
Text content.
ReadText(System.IO.Stream stream, System.Text.Encoding encoding) #Reads text from a stream.
Parameters
- stream System.IO.Stream
- Input stream.
- encoding System.Text.Encoding
- Optional text encoding (defaults to UTF-8).
Returns
Text content.
public static async Task<String> ReadTextAsync(Stream stream, Encoding encoding = null, CancellationToken cancellationToken = null) #Task<String>Reads text from a file asynchronously.
Parameters
- path System.String
- Input file path.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
Text content.
ReadTextAsync(System.IO.Stream stream, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken) #Reads text from a stream asynchronously.
Parameters
- stream System.IO.Stream
- Input stream.
- encoding System.Text.Encoding
- Optional text encoding (defaults to UTF-8).
- cancellationToken System.Threading.CancellationToken
- Cancellation token.
Returns
Text content.
public static Boolean TryReadBinary(String path, out Byte[] data) #BooleanAttempts to read binary data from a file.
Parameters
- path System.String
- Input file path.
- data System.Byte[]@
- Binary file contents.
Returns
True when the file exists and was read.
public static Boolean TryReadBinary(Stream stream, Int32 maxBytes, out Byte[] data) #BooleanAttempts to read binary data from a file with a size limit.
Parameters
- path System.String
- Input file path.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
- data System.Byte[]@
- Binary file contents.
Returns
True when the file exists and was read.
TryReadBinary(System.IO.Stream stream, System.Int32 maxBytes, System.Byte[]@ data) #Attempts to read binary data from a stream with a size limit.
Parameters
- stream System.IO.Stream
- Input stream.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
- data System.Byte[]@
- Binary data.
Returns
True when the stream was read within the limit.
public static async Task<Byte[]> TryReadBinaryAsync(String path, Int32 maxBytes, CancellationToken cancellationToken = null) #Task<Byte[]>Attempts to read binary data from a stream asynchronously with a size limit.
Parameters
- stream System.IO.Stream
- Input stream.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
Binary data when successful; otherwise null.
TryReadBinaryAsync(System.String path, System.Int32 maxBytes, System.Threading.CancellationToken cancellationToken) #Attempts to read binary data from a file asynchronously with a size limit.
Parameters
- path System.String
- Input file path.
- maxBytes System.Int32
- Maximum bytes to read (0 to disable).
- cancellationToken System.Threading.CancellationToken
- Cancellation token.
Returns
Binary data when successful; otherwise null.
public static Boolean TryReadText(String path, out String text, Encoding encoding = null) #BooleanAttempts to read text from a file.
Parameters
- path System.String
- Input file path.
- text System.String@
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
Returns
True when the file exists and was read.
public static Void WriteBinary(Stream stream, Byte[] data) #VoidWrites binary data to a file and returns the full path.
Parameters
- path System.String
- Output file path.
- data System.Byte[]
- Binary data to write.
Returns
The output file path.
public static String WriteBinary(String directory, String fileName, Byte[] data) #StringWrites binary data to a file under the specified directory.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name.
- data System.Byte[]
- Binary data to write.
Returns
The output file path.
WriteBinary(System.IO.Stream stream, System.Byte[] data) #Writes binary data to a stream.
Parameters
- stream System.IO.Stream
- Target stream.
- data System.Byte[]
- Binary data to write.
public static Task WriteBinaryAsync(Stream stream, Byte[] data, CancellationToken cancellationToken = null) #TaskWrites binary data to a file asynchronously and returns the full path.
Parameters
- path System.String
- Output file path.
- data System.Byte[]
- Binary data to write.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
The output file path.
public static Task<String> WriteBinaryAsync(String directory, String fileName, Byte[] data, CancellationToken cancellationToken = null) #Task<String>Writes binary data to a file under the specified directory asynchronously.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name.
- data System.Byte[]
- Binary data to write.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
The output file path.
WriteBinaryAsync(System.IO.Stream stream, System.Byte[] data, System.Threading.CancellationToken cancellationToken) #Writes binary data to a stream asynchronously.
Parameters
- stream System.IO.Stream
- Target stream.
- data System.Byte[]
- Binary data to write.
- cancellationToken System.Threading.CancellationToken
- Cancellation token.
public static String WriteBinarySafe(String directory, String fileName, Byte[] data) #StringWrites binary data to a file under the specified directory with a safe file name.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name (no path separators).
- data System.Byte[]
- Binary data to write.
Returns
The output file path.
public static Task<String> WriteBinarySafeAsync(String directory, String fileName, Byte[] data, CancellationToken cancellationToken = null) #Task<String>Writes binary data to a file under the specified directory asynchronously with a safe file name.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name (no path separators).
- data System.Byte[]
- Binary data to write.
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
The output file path.
public static Void WriteText(Stream stream, String text, Encoding encoding = null) #VoidWrites text to a file and returns the full path.
Parameters
- path System.String
- Output file path.
- text System.String
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
Returns
The output file path.
WriteText(System.IO.Stream stream, System.String text, System.Text.Encoding encoding) #Writes text to a stream.
Parameters
- stream System.IO.Stream
- Target stream.
- text System.String
- Text content.
- encoding System.Text.Encoding
- Optional text encoding (defaults to UTF-8).
public static String WriteText(String directory, String fileName, String text, Encoding encoding = null) #StringWrites text to a file under the specified directory.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name.
- text System.String
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
Returns
The output file path.
public static Task WriteTextAsync(Stream stream, String text, Encoding encoding = null, CancellationToken cancellationToken = null) #TaskWrites text to a file asynchronously and returns the full path.
Parameters
- path System.String
- Output file path.
- text System.String
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
The output file path.
WriteTextAsync(System.IO.Stream stream, System.String text, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken) #Writes text to a stream asynchronously.
Parameters
- stream System.IO.Stream
- Target stream.
- text System.String
- Text content.
- encoding System.Text.Encoding
- Optional text encoding (defaults to UTF-8).
- cancellationToken System.Threading.CancellationToken
- Cancellation token.
public static Task<String> WriteTextAsync(String directory, String fileName, String text, Encoding encoding = null, CancellationToken cancellationToken = null) #Task<String>Writes text to a file under the specified directory asynchronously.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name.
- text System.String
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
The output file path.
public static String WriteTextSafe(String directory, String fileName, String text, Encoding encoding = null) #StringWrites text to a file under the specified directory with a safe file name.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name (no path separators).
- text System.String
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
Returns
The output file path.
public static Task<String> WriteTextSafeAsync(String directory, String fileName, String text, Encoding encoding = null, CancellationToken cancellationToken = null) #Task<String>Writes text to a file under the specified directory asynchronously with a safe file name.
Parameters
- directory System.String
- Output directory.
- fileName System.String
- Output file name (no path separators).
- text System.String
- Text content.
- encoding System.Text.Encoding = null
- Optional text encoding (defaults to UTF-8).
- cancellationToken System.Threading.CancellationToken = null
- Cancellation token.
Returns
The output file path.