EnsureSpace() public méthode

public EnsureSpace ( int length ) : void
length int
Résultat void
Exemple #1
0
        public ValueString ReadToEnd()
        {
            if (_stream == null)
            {
                throw new InvalidOperationException();
            }

            //CheckAsyncTaskInProgress();

            // Call ReadBuffer, then pull data out of charBuffer.

            int?streamLength = null;

            try
            {
                streamLength = (int)(_stream.Length - _stream.Position) + this._byteLen;
            }
            catch
            {
            }
            if (streamLength != null)
            {
                mv.EnsureSpace(this._encoding.GetMaxCharCount(streamLength.Value));
            }
            else
            {
                mv.EnsureSpace(_charBuffer.Length * 4);
            }

            var parts = new List <ValueString>();

            do
            {
                var p = mv.CreateValueString(_charBuffer, _charPos, _charLen - _charPos);
                parts.Add(p);
                _charPos = _charLen;  // Note we consumed these characters
                ReadBuffer();
            } while (_charLen > 0);
            return(mv.Concatenate(parts));
        }