Exemplo n.º 1
0
 public ByteString ReadLine()
 {
     ByteString str = null;
     for (int i = this._pos; i < this._bytes.Length; i++)
     {
         if (this._bytes[i] == 10)
         {
             int length = i - this._pos;
             if ((length > 0) && (this._bytes[i - 1] == 13))
             {
                 length--;
             }
             str = new ByteString(this._bytes, this._pos, length);
             this._pos = i + 1;
             return str;
         }
     }
     if (this._pos < this._bytes.Length)
     {
         str = new ByteString(this._bytes, this._pos, this._bytes.Length - this._pos);
     }
     this._pos = this._bytes.Length;
     return str;
 }
Exemplo n.º 2
0
 public ByteString[] Split(char sep)
 {
     ArrayList list = new ArrayList();
     int offset = 0;
     while (offset < this._length)
     {
         int index = this.IndexOf(sep, offset);
         if (index < 0)
         {
             break;
         }
         list.Add(this.Substring(offset, index - offset));
         offset = index + 1;
         while ((this[offset] == ((byte) sep)) && (offset < this._length))
         {
             offset++;
         }
     }
     if (offset < this._length)
     {
         list.Add(this.Substring(offset));
     }
     int count = list.Count;
     ByteString[] strArray = new ByteString[count];
     for (int i = 0; i < count; i++)
     {
         strArray[i] = (ByteString) list[i];
     }
     return strArray;
 }