IronRuby.Builtins.RubyIO.WriteBytes C# (CSharp) Method

WriteBytes() private method

private WriteBytes ( byte bytes, MutableString str, int index, int count ) : int
bytes byte
str MutableString
index int
count int
return int
        private int WriteBytes(byte[] bytes, MutableString str, int index, int count) {
            var stream = GetWritableStream();

            if ((_mode & IOMode.WriteAppends) != 0 && stream.CanSeek) {
                stream.Seek(0, SeekOrigin.End);
            }

            try {
                if (bytes != null) {
                    return stream.WriteBytes(bytes, index, count, PreserveEndOfLines);
                } else {
                    return stream.WriteBytes(str, index, count, PreserveEndOfLines);
                }
            } catch (ObjectDisposedException) {
                throw RubyExceptions.CreateEBADF();
            }
        }

Same methods

RubyIO::WriteBytes ( MutableString buffer, int index, int count ) : int
RubyIO::WriteBytes ( byte buffer, int index, int count ) : int
RubyIO::WriteBytes ( char buffer, int index, int count ) : int
RubyIO::WriteBytes ( string value ) : int

Usage Example

Beispiel #1
0
        public static int Write(RubyIO /*!*/ self, [NotNull] MutableString /*!*/ val)
        {
            int bytesWritten = val.IsEmpty ? 0 : self.WriteBytes(val, 0, val.GetByteCount());

            if (self.AutoFlush)
            {
                self.Flush();
            }
            return(bytesWritten);
        }
All Usage Examples Of IronRuby.Builtins.RubyIO::WriteBytes