Method FastBuffer<T>.TryRead(+ 4 overloads)
Overload
Gets a read-only span whose memory is in the buffer at FastBuffer<T>.Position. No copying.
public bool TryRead<TElem>(int nElem, out ReadOnlySpan<TElem> data) where TElem : unmanaged
Parameters
|
nElem (int)
Number of elements of type TElem in the returned span. |
|
data (ReadOnlySpan<TElem>)
Read-only span to return. |
Returns
|
bool
|
Exceptions
|
InvalidOperationException
The generic type of this is not |
Type Parameters
| TElem |
Remarks
The generic type of this must be byte.
If successful, finally sets FastBuffer<T>.Position = the end of the requested data.
Overload(next)
Gets a read-only span whose memory is in the buffer at FastBuffer<T>.Position. No copying.
At first reads its length as int.
public bool TryRead<TElem>(out ReadOnlySpan<TElem> data) where TElem : unmanaged
Parameters
|
data (ReadOnlySpan<TElem>)
Read-only span to return. |
Returns
|
bool
|
Exceptions
|
InvalidOperationException
The generic type of this is not |
Type Parameters
| TElem |
Remarks
The generic type of this must be byte.
If successful, finally sets FastBuffer<T>.Position = the end of the requested data.
Overload(next)
Reads a struct from the buffer at FastBuffer<T>.Position.
public bool TryRead<TData>(out TData data) where TData : unmanaged
Parameters
| data (TData) |
Returns
|
bool
|
Exceptions
|
InvalidOperationException
The generic type of this is not |
Type Parameters
| TData |
Remarks
The generic type of this must be byte.
If successful, finally sets FastBuffer<T>.Position = the end of the requested data.
Overload(next)
Reads a string of specified length from the buffer at FastBuffer<T>.Position.
public bool TryRead(int nChars, out string data)
Parameters
Returns
|
bool
|
Exceptions
|
InvalidOperationException
The generic type of this is not |
Remarks
The generic type of this must be byte.
If successful, finally sets FastBuffer<T>.Position = the end of the requested data.
Overload(top)
Reads a string from the buffer at FastBuffer<T>.Position.
At first reads its length as int.
public bool TryRead(out string data)
Parameters
| data (string) |
Returns
|
bool
|
Exceptions
|
InvalidOperationException
The generic type of this is not |
Remarks
The generic type of this must be byte.
If successful, finally sets FastBuffer<T>.Position = the end of the requested data.