Ejemplo n.º 1
0
        public void Skip(int count)
        {
            this.positionIndex += count;
            DecoderErrorCode errorCode = this.positionIndex >= this.InputStream.Length ? DecoderErrorCode.UnexpectedEndOfStream : DecoderErrorCode.NoError;

            errorCode.EnsureNoError();
        }
Ejemplo n.º 2
0
        public int ReceiveExtend(int t, ref InputProcessor inputProcessor)
        {
            int x;
            DecoderErrorCode errorCode = this.ReceiveExtendUnsafe(t, ref inputProcessor, out x);

            errorCode.EnsureNoError();
            return(x);
        }
Ejemplo n.º 3
0
        public byte ReadByte(Stream inputStream)
        {
            byte             result;
            DecoderErrorCode errorCode = this.ReadByteUnsafe(inputStream, out result);

            errorCode.EnsureNoError();
            return(result);
        }
        /// <summary>
        /// If errorCode indicates unexpected EOF, sets <see cref="UnexpectedEndOfStreamReached"/> to true and returns false.
        /// Calls <see cref="DecoderThrowHelper.EnsureNoError"/> and returns true otherwise.
        /// </summary>
        /// <param name="errorCode">The <see cref="DecoderErrorCode"/></param>
        /// <returns><see cref="bool"/> indicating whether everything is OK</returns>
        public bool CheckEOFEnsureNoError(DecoderErrorCode errorCode)
        {
            if (errorCode == DecoderErrorCode.UnexpectedEndOfStream)
            {
                this.UnexpectedEndOfStreamReached = true;
                return(false);
            }

            errorCode.EnsureNoError();
            return(true);
        }
Ejemplo n.º 5
0
        public Span <byte> ReadFull(int offset, int length)
        {
            DecoderErrorCode errorCode = DecoderErrorCode.NoError;

            if (this.InputStream.Length < this.positionIndex + offset + length)
            {
                errorCode = DecoderErrorCode.UnexpectedEndOfStream;
            }
            errorCode.EnsureNoError();
            Span <byte> span = this.InputStream.Slice(this.positionIndex + offset, length);

            this.positionIndex += length;
            return(span);
        }
Ejemplo n.º 6
0
        public void EnsureNBits(int n, ref InputProcessor inputProcessor)
        {
            DecoderErrorCode errorCode = this.EnsureNBitsUnsafe(n, ref inputProcessor);

            errorCode.EnsureNoError();
        }
        public void ReadFull(byte[] data, int offset, int length)
        {
            DecoderErrorCode errorCode = this.ReadFullUnsafe(data, offset, length);

            errorCode.EnsureNoError();
        }
        public void Skip(int count)
        {
            DecoderErrorCode errorCode = this.SkipUnsafe(count);

            errorCode.EnsureNoError();
        }
Ejemplo n.º 9
0
        public void Fill(Stream inputStream)
        {
            DecoderErrorCode errorCode = this.FillUnsafe(inputStream);

            errorCode.EnsureNoError();
        }