예제 #1
0
파일: BlobReader.cs 프로젝트: jnm2/corefx
        private int ReadCompressedIntegerOrInvalid()
        {
            int bytesRead;
            int value = _block.PeekCompressedInteger(this.Offset, out bytesRead);

            _currentPointer += bytesRead;
            return(value);
        }
예제 #2
0
        internal byte[] GetBytes(BlobHandle handle)
        {
            int offset = handle.GetHeapOffset();
            int bytesRead;
            int numberOfBytes = Block.PeekCompressedInteger(offset, out bytesRead);

            if (numberOfBytes == BlobReader.InvalidCompressedInteger)
            {
                return(ImmutableArray <byte> .Empty.UnderlyingArray);
            }

            return(Block.PeekBytes(offset + bytesRead, numberOfBytes));
        }
예제 #3
0
        internal byte[] GetBytes(BlobHandle handle)
        {
            if (handle.IsVirtual)
            {
                // consider: if we returned an ImmutableArray we wouldn't need to copy
                return(GetVirtualBlobBytes(handle, unique: true));
            }

            int offset = handle.GetHeapOffset();
            int bytesRead;
            int numberOfBytes = Block.PeekCompressedInteger(offset, out bytesRead);

            if (numberOfBytes == BlobReader.InvalidCompressedInteger)
            {
                return(EmptyArray <byte> .Instance);
            }

            return(Block.PeekBytes(offset + bytesRead, numberOfBytes));
        }