Skip to content

Commit

Permalink
seek
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekGooding committed Oct 1, 2024
1 parent 4bf2d0f commit bd9517b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Projects/Server/Serialization/BinaryFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ public void Dispose()
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int Read(Span<byte> buffer) => _reader.Read(buffer);

/// <summary>
/// Sets the current position of the stream to a specified value.
/// </summary>
/// <param name="offset">The new position, relative to the <paramref name="origin"/> parameter.</param>
/// <param name="origin">The reference point for the <paramref name="offset"/> parameter. It can be one of the values of <see cref="SeekOrigin"/>.</param>
/// <returns>The new position in the stream, in bytes.</returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="offset"/> or the resulting position is out of the valid range.</exception>
/// <exception cref="InvalidOperationException">Thrown if the stream does not support seeking.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public long Seek(long offset, SeekOrigin origin) => _reader.Seek(offset, origin);
}
8 changes: 8 additions & 0 deletions Projects/Server/Serialization/UnmanagedDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,14 @@ public int Read(Span<byte> buffer)
return length;
}

/// <summary>
/// Sets the current position of the stream to a specified value.
/// </summary>
/// <param name="offset">The new position, relative to the <paramref name="origin"/> parameter.</param>
/// <param name="origin">The reference point for the <paramref name="offset"/> parameter. It can be one of the values of <see cref="SeekOrigin"/>.</param>
/// <returns>The new position in the stream, in bytes.</returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="offset"/> or the resulting position is out of the valid range.</exception>
/// <exception cref="InvalidOperationException">Thrown if the stream does not support seeking.</exception>
public virtual long Seek(long offset, SeekOrigin origin)
{
Debug.Assert(
Expand Down

0 comments on commit bd9517b

Please sign in to comment.