示例#1
0
        public MutableString ReadLineOrParagraph(MutableString separator, RubyEncoding /*!*/ encoding, bool preserveEndOfLines, int limit)
        {
            ContractUtils.Requires(limit >= 0);

            if (limit == 0)
            {
                return(MutableString.CreateEmpty());
            }
            else if (separator == null)
            {
                var result = MutableString.CreateBinary();
                return(AppendBytes(result, limit, preserveEndOfLines) == 0 ? null : result);
            }
            else if (separator.StartsWith('\n') && separator.GetLength() == 1)
            {
                return(ReadLine(encoding, preserveEndOfLines, limit));
            }
            else if (separator.IsEmpty)
            {
                return(ReadParagraph(encoding, preserveEndOfLines, limit));
            }
            else
            {
                return(ReadLine(separator, encoding, preserveEndOfLines, limit));
            }
        }
示例#2
0
 public MutableString ReadLineOrParagraph(MutableString separator, RubyEncoding /*!*/ encoding, bool preserveEndOfLines)
 {
     if (separator == null)
     {
         var result = MutableString.CreateBinary();
         return(AppendBytes(result, Int32.MaxValue, preserveEndOfLines) == 0 ? null : result);
     }
     else if (separator.StartsWith('\n') && separator.GetLength() == 1)
     {
         return(ReadLine(encoding, preserveEndOfLines));
     }
     else if (separator.IsEmpty)
     {
         return(ReadParagraph(encoding, preserveEndOfLines));
     }
     else
     {
         return(ReadLine(separator, encoding, preserveEndOfLines));
     }
 }