public WriteBytes ( MutableString buffer, int offset, int count, bool preserveEndOfLines ) : int | ||
buffer | MutableString | |
offset | int | |
count | int | |
preserveEndOfLines | bool | |
Résultat | int |
public void File_WriteBytes1() { var stream = new MemoryStream(); var io = new RubyBufferedStream(stream); io.Write(new byte[] { 0, 1, 2, 3 }, 1, 2); Assert(stream.ToArray().ValueEquals(new byte[] { 1, 2 })); stream.Seek(0, SeekOrigin.Begin); Assert(io.WriteBytes(new byte[] { 0, 1, 2, 3 }, 1, 2, true) == 2); Assert(stream.ToArray().ValueEquals(new byte[] { 1, 2 })); stream.Seek(0, SeekOrigin.Begin); Assert(io.WriteBytes(new byte[] { 0, 1, 2, 3 }, 1, 2, false) == 2); Assert(stream.ToArray().ValueEquals(new byte[] { 1, 2 })); stream.Seek(0, SeekOrigin.Begin); Assert(io.WriteBytes(new byte[] { 0, 1, (byte)'\n', 2 }, 1, 2, false) == 3); Assert(stream.ToArray().ValueEquals(new byte[] { 1, (byte)'\r', (byte)'\n' })); stream.Seek(0, SeekOrigin.Begin); }