Write() публичный Метод

public Write ( byte buffer, int offset, int count ) : void
buffer byte
offset int
count int
Результат void
Пример #1
0
		public void testWrite_CH_PROGRESS()
		{
			SideBandOutputStream o;
			o = new SideBandOutputStream(SideBandOutputStream.CH_PROGRESS, SideBandOutputStream.SMALL_BUF, rawOut);
			byte[] b = new byte[] { (byte)'a', (byte)'b', (byte)'c' };
			o.Write(b, 0, b.Length);
			o.Flush();
			assertBuffer("0008\x02" + "abc");
		}
Пример #2
0
		public void testWrite_SmallBlocks3()
		{
			SideBandOutputStream o;
			o = new SideBandOutputStream(SideBandOutputStream.CH_DATA, 7, rawOut);
			o.WriteByte((byte)'a');
			o.Write(new byte[] { (byte)'b', (byte)'c' }, 0, 2);
			o.Flush();
			assertBuffer("0007\x01" + "ab0006\x01" + "c");
		}
Пример #3
0
		public void testWrite_Large()
		{
			const int buflen = SideBandOutputStream.MAX_BUF - SideBandOutputStream.HDR_SIZE;
			byte[] buf = new byte[buflen];
			for (int i = 0; i < buf.Length; i++)
				buf[i] = (byte)i;

			SideBandOutputStream o;
			o = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, rawOut);
			o.Write(buf, 0, buf.Length);
			o.Flush();
			byte[] act = rawOut.ToArray();
			string explen = NB.DecimalToBase(buf.Length + SideBandOutputStream.HDR_SIZE, 16);
			Assert.AreEqual(SideBandOutputStream.HDR_SIZE + buf.Length, act.Length);
			Assert.AreEqual(Charset.forName("UTF-8").GetString(act, 0, 4), explen);
			Assert.AreEqual(1, act[4]);
			for (int i = 0, j = SideBandOutputStream.HDR_SIZE; i < buf.Length; i++, j++)
				Assert.AreEqual(buf[i], act[j]);
		}
Пример #4
0
 public void testWrite_CH_ERROR()
 {
     SideBandOutputStream o;
     o = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, pckOut);
     byte[] b = new byte[] { (byte)'a', (byte)'b', (byte)'c' };
     o.Write(b, 0, b.Length);
     assertBuffer("0008\x03" + "abc");
 }