WriteLine() public method

Write a specific line to the output stream, without its trailing LF.
Write a specific line to the output stream, without its trailing LF.

The specified line is copied as-is, with no character encoding translation performed.

If the specified line ends with an LF ('\n'), the LF is not copied. It is up to the caller to write the LF, if desired, between output lines.

the stream write operation failed.
public WriteLine ( OutputStream @out, int i ) : void
@out Sharpen.OutputStream
i int /// index of the line to extract. Note this is 0-based, so line /// number 1 is actually index 0. ///
return void
Exemplo n.º 1
0
		public virtual void TestWriteLine1()
		{
			RawText a = new RawText(Constants.EncodeASCII("foo-a\nfoo-b\n"));
			ByteArrayOutputStream o = new ByteArrayOutputStream();
			a.WriteLine(o, 0);
			byte[] r = o.ToByteArray();
			NUnit.Framework.Assert.AreEqual("foo-a", RawParseUtils.Decode(r));
		}
Exemplo n.º 2
0
        public virtual void TestWriteLine2()
        {
            RawText a = new RawText(Constants.EncodeASCII("foo-a\nfoo-b"));
            ByteArrayOutputStream o = new ByteArrayOutputStream();

            a.WriteLine(o, 1);
            byte[] r = o.ToByteArray();
            NUnit.Framework.Assert.AreEqual("foo-b", RawParseUtils.Decode(r));
        }
Exemplo n.º 3
0
 /// <summary>Write a standard patch script line.</summary>
 /// <remarks>Write a standard patch script line.</remarks>
 /// <param name="prefix">prefix before the line, typically '-', '+', ' '.</param>
 /// <param name="text">the text object to obtain the line from.</param>
 /// <param name="cur">line number to output.</param>
 /// <exception cref="System.IO.IOException">the stream threw an exception while writing to it.
 ///     </exception>
 protected internal virtual void WriteLine(char prefix, RawText text, int cur)
 {
     @out.Write(prefix);
     text.WriteLine(@out, cur);
     @out.Write('\n');
 }
Exemplo n.º 4
0
 public virtual void TestWriteLine3()
 {
     RawText a = new RawText(Constants.EncodeASCII("a\n\nb\n"));
     ByteArrayOutputStream o = new ByteArrayOutputStream();
     a.WriteLine(o, 1);
     byte[] r = o.ToByteArray();
     NUnit.Framework.Assert.AreEqual(string.Empty, RawParseUtils.Decode(r));
 }