Table of Contents

Class NpgsqlReadBuffer

Namespace
Npgsql
Assembly
Npgsql.dll

A buffer used by Npgsql to read data from the socket efficiently. Provides methods which decode different values types and tracks the current position.

public sealed class NpgsqlReadBuffer
Inheritance
NpgsqlReadBuffer
Inherited Members

Properties

Connection

public NpgsqlConnection Connection { get; }

Property Value

NpgsqlConnection

Methods

Ensure(int, bool)

Ensures that count bytes are available in the buffer, and if not, reads from the socket until enough is available.

public Task Ensure(int count, bool async)

Parameters

count int
async bool

Returns

Task

GetStream(int, bool)

public Stream GetStream(int len, bool canSeek)

Parameters

len int
canSeek bool

Returns

Stream

ReadByte()

public byte ReadByte()

Returns

byte

ReadBytes(byte[], int, int)

public void ReadBytes(byte[] output, int outputOffset, int len)

Parameters

output byte[]
outputOffset int
len int

ReadBytes(byte[], int, int, bool)

public ValueTask<int> ReadBytes(byte[] output, int outputOffset, int len, bool async)

Parameters

output byte[]
outputOffset int
len int
async bool

Returns

ValueTask<int>

ReadBytes(Span<byte>)

public void ReadBytes(Span<byte> output)

Parameters

output Span<byte>

ReadChars(int)

public char[] ReadChars(int byteLen)

Parameters

byteLen int

Returns

char[]

ReadDouble()

public double ReadDouble()

Returns

double

ReadDouble(bool)

public double ReadDouble(bool littleEndian)

Parameters

littleEndian bool

Returns

double

ReadInt16()

public short ReadInt16()

Returns

short

ReadInt16(bool)

public short ReadInt16(bool littleEndian)

Parameters

littleEndian bool

Returns

short

ReadInt32()

public int ReadInt32()

Returns

int

ReadInt32(bool)

public int ReadInt32(bool littleEndian)

Parameters

littleEndian bool

Returns

int

ReadInt64()

public long ReadInt64()

Returns

long

ReadInt64(bool)

public long ReadInt64(bool littleEndian)

Parameters

littleEndian bool

Returns

long

ReadNullTerminatedString()

Seeks the first null terminator (\0) and returns the string up to it. The buffer must already contain the entire string and its terminator.

public string ReadNullTerminatedString()

Returns

string

ReadSByte()

public sbyte ReadSByte()

Returns

sbyte

ReadSingle()

public float ReadSingle()

Returns

float

ReadSingle(bool)

public float ReadSingle(bool littleEndian)

Parameters

littleEndian bool

Returns

float

ReadString(int)

public string ReadString(int byteLen)

Parameters

byteLen int

Returns

string

ReadUInt16()

public ushort ReadUInt16()

Returns

ushort

ReadUInt16(bool)

public ushort ReadUInt16(bool littleEndian)

Parameters

littleEndian bool

Returns

ushort

ReadUInt32()

public uint ReadUInt32()

Returns

uint

ReadUInt32(bool)

public uint ReadUInt32(bool littleEndian)

Parameters

littleEndian bool

Returns

uint

ReadUInt64()

public ulong ReadUInt64()

Returns

ulong

ReadUInt64(bool)

public ulong ReadUInt64(bool littleEndian)

Parameters

littleEndian bool

Returns

ulong

Skip(long, bool)

Skip a given number of bytes.

public Task Skip(long len, bool async)

Parameters

len long
async bool

Returns

Task