MailKit.Net.Imap.ImapStream.ReadAtomString C# (CSharp) Method

ReadAtomString() private method

private ReadAtomString ( byte inbuf, bool flag, string specials, CancellationToken cancellationToken ) : string
inbuf byte
flag bool
specials string
cancellationToken System.Threading.CancellationToken
return string
		unsafe string ReadAtomString (byte* inbuf, bool flag, string specials, CancellationToken cancellationToken)
		{
			var builder = new StringBuilder ();
			byte* inptr = inbuf + inputIndex;
			byte* inend = inbuf + inputEnd;

			do {
				*inend = (byte) '\n';

				if (flag && builder.Length == 0 && *inptr == (byte) '*') {
					// this is a special wildcard flag
					inputIndex++;
					return "*";
				}

				while (IsAtom (*inptr, specials))
					builder.Append ((char) *inptr++);

				if (inptr < inend)
					break;

				inputIndex = (int) (inptr - inbuf);

				ReadAhead (1, cancellationToken);

				inptr = inbuf + inputIndex;
				inend = inbuf + inputEnd;
			} while (true);

			inputIndex = (int) (inptr - inbuf);

			return builder.ToString ();
		}