Class BinaryFile
A convenience wrapper for arbitrary data. This is a reusable, read-only wrapper around the original file that is used throughout this library. A BinaryFile can be created using the static builder methods From(String) or From(Byte[]). Once a BinaryFile has been created, the contents cannot be changed.
Inheritance
Namespace: PTIRelianceLib
Assembly: PTIRelianceLib.dll
Syntax
public sealed class BinaryFile : object
Properties
| Improve this Doc View SourceEmpty
Returns true
if this BinaryFile is empty
Declaration
public bool Empty { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if no data is in this BinaryFile |
Item[Int32]
Read-only indexer
Declaration
public byte this[int key] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | key | Index to read |
Property Value
Type | Description |
---|---|
System.Byte | byte value at index |
Length
Returns the length in bytes of this file
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Integer length of data in this BinaryFile in bytes |
LongLength
Returns the length in bytes of this file
Declaration
public long LongLength { get; }
Property Value
Type | Description |
---|---|
System.Int64 | Long length of data in this BinaryFile in bytes |
Methods
| Improve this Doc View SourceFrom(Byte[])
Construct a BinaryFile from a buffer
in memory.
Declaration
public static BinaryFile From(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | Memory to copy into a new BinaryFile |
Returns
Type | Description |
---|---|
BinaryFile | BinaryFile |
From(String)
Construct a BinaryFile from a physical file location at path
.
Declaration
public static BinaryFile From(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path to source file |
Returns
Type | Description |
---|---|
BinaryFile | BinaryFile contains data from |
GetData()
Returns a copy of this data
Declaration
public byte[] GetData()
Returns
Type | Description |
---|---|
System.Byte[] | byte[] |