Class BinIoUtil
Utility class for binary I/O operations.
public static class BinIoUtil
- Inheritance
-
BinIoUtil
- Inherited Members
Methods
GetBytesWithWriter(Action<BinaryWriter>)
Gets a byte array by executing an action with a BinaryWriter.
public static byte[] GetBytesWithWriter(Action<BinaryWriter> action)
Parameters
action
Action<BinaryWriter>The action to execute with the BinaryWriter.
Returns
- byte[]
The resulting byte array.
GetWithReader<T>(Func<BinaryReader, T>, byte[])
Gets a result by executing a function with a BinaryReader created from the provided byte array.
public static T GetWithReader<T>(Func<BinaryReader, T> Func, byte[] bytes)
Parameters
Func
Func<BinaryReader, T>The function to execute with the BinaryReader.
bytes
byte[]The byte array to read from.
Returns
- T
The result of the function execution.
Type Parameters
T
The type of the result.
RunWithReader(Action<BinaryReader>, byte[])
Executes an action with a BinaryReader created from the provided byte array.
public static void RunWithReader(Action<BinaryReader> action, byte[] bytes)
Parameters
action
Action<BinaryReader>The action to execute with the BinaryReader.
bytes
byte[]The byte array to read from.
ToBytes(IWriteBin)
Converts an object implementing IWriteBin interface to a byte array.
public static byte[] ToBytes(this IWriteBin src)
Parameters
src
IWriteBinThe source object that implements IWriteBin.
Returns
- byte[]
The byte array representation of the object.