src/AnvilPacker/Data/IO/DataReader.cs
/// <summary> Returns a subview of the current reader. </summary>
/// <remarks> This reader should not be used until the returned object is disposed. </remarks>
Returns a subview of the current reader.
Returns a subview of the current reader .
public DataReader Slice(int length)
        {
            Stream stream;
            if (BaseStream is StreamWrapper sw) {
                if (length > sw._remainingBytes) {
                    throw new EndOfStreamException();
                }
                sw._remainingBytes -= length;
                stream = sw._dr.AsStream(length);
            } else {
                stream = AsStream(length);
            }
            return new DataReader(stream, false);
        }
public DataReader Slice ( int length ) { Stream stream ; if ( BaseStream is StreamWrapper sw ) { if ( length > sw . _remainingBytes ) { throw new EndOfStreamException ( ) ; } sw . _remainingBytes -= length ; stream = sw . _dr . AsStream ( length ) ; } else { stream = AsStream ( length ) ; } return new DataReader ( stream , false ) ; }
Returns a subview of the current reader.
Returns a subview of the current reader .
//avoid nesting streams, each level could have a buffer copy
length
int
remarks
This reader should not be used until the returned object is disposed.
This reader should not be used until the returned object is disposed .