B2R2


BinReader Type

BinReader abstracts away the process of reading byte sequences. This is the base class for BinReader, which has two kinds of implementations: little-endian and big-endian BinReader.

Constructors

Constructor Description

BinReader(bytes)

Full Usage: BinReader(bytes)

Parameters:
    bytes : byte[]

Returns: BinReader
bytes : byte[]
Returns: BinReader

Instance members

Instance member Description

this.Bytes

Full Usage: this.Bytes

The byte array stored for this reader.

this.Endianness

Full Usage: this.Endianness

Returns: Endian
Modifiers: abstract

My endianness.

Returns: Endian

this.IsOutOfRange(o)

Full Usage: this.IsOutOfRange(o)

Parameters:
    o : int

Returns: bool

Is the given offset points to a position out of the range of the file?

o : int
Returns: bool

this.Length()

Full Usage: this.Length()

Returns: int

Length of the file for this reader.

Returns: int

this.PeekByte(o)

Full Usage: this.PeekByte(o)

Parameters:
    o : int

Returns: byte

Peek a single byte at the given offset.

o : int
Returns: byte

this.PeekBytes(n, o)

Full Usage: this.PeekBytes(n, o)

Parameters:
    n : int
    o : int

Returns: byte[]

Peek byte array of size n at the given offset.

n : int
o : int
Returns: byte[]

this.PeekChars(n, o)

Full Usage: this.PeekChars(n, o)

Parameters:
    n : int
    o : int

Returns: char[]

Peek a character array of size n at the given offset.

n : int
o : int
Returns: char[]

this.PeekInt16(o)

Full Usage: this.PeekInt16(o)

Parameters:
    o : int

Returns: int16
Modifiers: abstract

Peek an int16 value at the given offset.

o : int
Returns: int16

this.PeekInt32(o)

Full Usage: this.PeekInt32(o)

Parameters:
    o : int

Returns: int32
Modifiers: abstract

Peek an int32 value at the given offset.

o : int
Returns: int32

this.PeekInt32LEB128(o)

Full Usage: this.PeekInt32LEB128(o)

Parameters:
    o : int

Returns: int32 * int

Peek a LEB128-encoded integer at the given offset. This function returns a tuple of (the decoded int32, and the count of how many bytes were peeked).

o : int
Returns: int32 * int

this.PeekInt64(o)

Full Usage: this.PeekInt64(o)

Parameters:
    o : int

Returns: int64
Modifiers: abstract

Peek an int64 value at the given offset.

o : int
Returns: int64

this.PeekInt64LEB128(o)

Full Usage: this.PeekInt64LEB128(o)

Parameters:
    o : int

Returns: int64 * int

Peek a LEB128-encoded integer at the given offset. This function returns a tuple of (the decoded int64, and the count of how many bytes were peeked).

o : int
Returns: int64 * int

this.PeekInt8(o)

Full Usage: this.PeekInt8(o)

Parameters:
    o : int

Returns: int8

Peek a single byte as an int8 type at the given offset.

o : int
Returns: int8

this.PeekMem(n, o)

Full Usage: this.PeekMem(n, o)

Parameters:
    n : int
    o : int

Returns: ReadOnlyMemory<byte>

Peek Memory of size n at the given offset.

n : int
o : int
Returns: ReadOnlyMemory<byte>

this.PeekSpan(o)

Full Usage: this.PeekSpan(o)

Parameters:
    o : int

Returns: ReadOnlySpan<byte>

Peek span of bytes at the given offset to the end.

o : int
Returns: ReadOnlySpan<byte>

this.PeekSpan(n, o)

Full Usage: this.PeekSpan(n, o)

Parameters:
    n : int
    o : int

Returns: ReadOnlySpan<byte>

Peek span of bytes of size n at the given offset.

n : int
o : int
Returns: ReadOnlySpan<byte>

this.PeekUInt16(o)

Full Usage: this.PeekUInt16(o)

Parameters:
    o : int

Returns: uint16
Modifiers: abstract

Peek a uint16 value at the given offset.

o : int
Returns: uint16

this.PeekUInt32(o)

Full Usage: this.PeekUInt32(o)

Parameters:
    o : int

Returns: uint32
Modifiers: abstract

Peek a uint32 value at the given offset.

o : int
Returns: uint32

this.PeekUInt32LEB128(o)

Full Usage: this.PeekUInt32LEB128(o)

Parameters:
    o : int

Returns: uint32 * int

Peek a LEB128-encoded integer at the given offset. This function returns a tuple of (the decoded uint32, and the count of how many bytes were peeked).

o : int
Returns: uint32 * int

this.PeekUInt64(o)

Full Usage: this.PeekUInt64(o)

Parameters:
    o : int

Returns: uint64
Modifiers: abstract

Peek a uint64 value at the given offset.

o : int
Returns: uint64

this.PeekUInt64LEB128(o)

Full Usage: this.PeekUInt64LEB128(o)

Parameters:
    o : int

Returns: uint64 * int

Peek a LEB128-encoded integer at the given offset. This function returns a tuple of (the decoded uint64, and the count of how many bytes were peeked).

o : int
Returns: uint64 * int

this.PeekUInt8(o)

Full Usage: this.PeekUInt8(o)

Parameters:
    o : int

Returns: uint8

Peek a single byte as a uint8 type at the given offset.

o : int
Returns: uint8

this.ReadByte(o)

Full Usage: this.ReadByte(o)

Parameters:
    o : int

Returns: byte * int

Read a byte at the given offset. This function, unlike PeekByte, will return the next offset.

o : int
Returns: byte * int

this.ReadBytes(n, o)

Full Usage: this.ReadBytes(n, o)

Parameters:
    n : int
    o : int

Returns: byte[] * int

Read a byte array of size n at the given offset. This function, unlike PeekBytes, will return the next offset.

n : int
o : int
Returns: byte[] * int

this.ReadChars(n, o)

Full Usage: this.ReadChars(n, o)

Parameters:
    n : int
    o : int

Returns: char[] * int

Read a character array of size n at the given offset. This function, unlike PeekChars, will return the next offset.

n : int
o : int
Returns: char[] * int

this.ReadInt16(o)

Full Usage: this.ReadInt16(o)

Parameters:
    o : int

Returns: int16 * int

Read an int16 value at the given offset. This function, unlike PeekInt16, will return the next offset.

o : int
Returns: int16 * int

this.ReadInt32(o)

Full Usage: this.ReadInt32(o)

Parameters:
    o : int

Returns: int32 * int

Read an int32 value at the given offset. This function, unlike PeekInt32, will return the next offset.

o : int
Returns: int32 * int

this.ReadInt32LEB128(o)

Full Usage: this.ReadInt32LEB128(o)

Parameters:
    o : int

Returns: int32 * int

Read a LEB128-encoded integer into int32 at the given offset. This function, unlike PeekInt32LEB128, will return the next offset.

o : int
Returns: int32 * int

this.ReadInt64(o)

Full Usage: this.ReadInt64(o)

Parameters:
    o : int

Returns: int64 * int

Read an int64 value at the given offset. This function, unlike PeekInt64, will return the next offset.

o : int
Returns: int64 * int

this.ReadInt64LEB128(o)

Full Usage: this.ReadInt64LEB128(o)

Parameters:
    o : int

Returns: int64 * int

Read a LEB128-encoded integer into int64 at the given offset. This function, unlike PeekInt64LEB128, will return the next offset.

o : int
Returns: int64 * int

this.ReadInt8(o)

Full Usage: this.ReadInt8(o)

Parameters:
    o : int

Returns: int8 * int

Read an int8 value at the given offset. This function, unlike PeekInt8, will return the next offset.

o : int
Returns: int8 * int

this.ReadUInt16(o)

Full Usage: this.ReadUInt16(o)

Parameters:
    o : int

Returns: uint16 * int

Read a uint16 value at the given offset. This function, unlike PeekUInt16, will return the next offset.

o : int
Returns: uint16 * int

this.ReadUInt32(o)

Full Usage: this.ReadUInt32(o)

Parameters:
    o : int

Returns: uint32 * int

Read a uint32 value at the given offset. This function, unlike PeekUInt32, will return the next offset.

o : int
Returns: uint32 * int

this.ReadUInt32LEB128(o)

Full Usage: this.ReadUInt32LEB128(o)

Parameters:
    o : int

Returns: uint32 * int

Read a LEB128-encoded integer into uint32 at the given offset. This function, unlike PeekUInt32LEB128, will return the next offset.

o : int
Returns: uint32 * int

this.ReadUInt64(o)

Full Usage: this.ReadUInt64(o)

Parameters:
    o : int

Returns: uint64 * int

Read a uint64 value at the given offset. This function, unlike PeekUInt64, will return the next offset.

o : int
Returns: uint64 * int

this.ReadUInt64LEB128(o)

Full Usage: this.ReadUInt64LEB128(o)

Parameters:
    o : int

Returns: uint64 * int

Read a LEB128-encoded integer into uint64 at the given offset. This function, unlike PeekUInt64LEB128, will return the next offset.

o : int
Returns: uint64 * int

this.ReadUInt8(o)

Full Usage: this.ReadUInt8(o)

Parameters:
    o : int

Returns: uint8 * int

Read a uint8 value at the given offset. This function, unlike PeekUInt8, will return the next offset.

o : int
Returns: uint8 * int

this.SubReader(offset) (len)

Full Usage: this.SubReader(offset) (len)

Parameters:
    offset : int
    len : int

Returns: BinReader

Return a sub BinReader that serves a subset of the bytes starting at the offset (offset) and of the length (len).

offset : int
len : int
Returns: BinReader

Static members

Static member Description

BinReader.Init(bytes, ?endian)

Full Usage: BinReader.Init(bytes, ?endian)

Parameters:
    bytes : byte[]
    ?endian : Endian

Returns: BinReader

Instantiate BinReader from a given byte array and endianness.

bytes : byte[]
?endian : Endian
Returns: BinReader

BinReader.RenewReader(reader) (endian)

Full Usage: BinReader.RenewReader(reader) (endian)

Parameters:
Returns: BinReader

Return a new BinReader of the given endianness. This function will return the same reader if the given endianness is the same as the endianness of the original reader.

reader : BinReader
endian : Endian
Returns: BinReader