public static object Getc(RubyIO /*!*/ self) { self.AssertOpenedForReading(); int c = self.ReadByteNormalizeEoln(); return((c != -1) ? ScriptingRuntimeHelpers.Int32ToObject(c) : null); }
public static int ReadChar(RubyIO /*!*/ self) { self.AssertOpenedForReading(); int c = self.ReadByteNormalizeEoln(); if (c == -1) { throw new EOFError("end of file reached"); } return(c); }
public static int ReadChar(RubyIO /*!*/ self) { self.RequireReadable(); int c = self.ReadByteNormalizeEoln(); if (c == -1) { throw new EOFError("end of file reached"); } return(c); }
public static MutableString /*!*/ Read(RubyIO /*!*/ self) { self.AssertOpenedForReading(); if (!self.PreserveEndOfLines) { MutableString result = MutableString.CreateBinary(); int c; while ((c = self.ReadByteNormalizeEoln()) != -1) { result.Append((byte)c); } return(result); } else { // TODO: change this once Binary mutable string uses resizable byte[] instead of List<byte> return(MutableString.CreateBinary(ReadAllBytes(self))); } }
public static MutableString /*!*/ Read(RubyIO /*!*/ self, [DefaultProtocol] int bytes, [DefaultProtocol, Optional] MutableString buffer) { self.AssertOpenedForReading(); if (self.IsEndOfStream()) { return(null); } if (buffer == null) { buffer = MutableString.CreateBinary(); } buffer.Clear(); if (!self.PreserveEndOfLines) { for (int i = 0; i < bytes; ++i) { int c = self.ReadByteNormalizeEoln(); if (c == -1) { return(buffer); } else { buffer.Append((byte)c); } } } else { var fixedBuffer = new byte[bytes]; bytes = self.ReadBytes(fixedBuffer, 0, bytes); buffer.Append(fixedBuffer, 0, bytes); } return(buffer); }
public static int ReadChar(RubyIO/*!*/ self) { self.RequireReadable(); int c = self.ReadByteNormalizeEoln(); if (c == -1) { throw new EOFError("end of file reached"); } return c; }
public static object Getc(RubyIO/*!*/ self) { int c = self.ReadByteNormalizeEoln(); return (c != -1) ? ScriptingRuntimeHelpers.Int32ToObject(c) : null; }
public static int ReadChar(RubyIO/*!*/ self) { self.AssertOpenedForReading(); int c = self.ReadByteNormalizeEoln(); if (c == -1) { throw new EOFError("end of file reached"); } return c; }
public static MutableString/*!*/ Read(RubyIO/*!*/ self, [DefaultProtocol]int bytes, [DefaultProtocol, Optional]MutableString buffer) { self.AssertOpenedForReading(); if (self.IsEndOfStream()) { return null; } if (buffer == null) { buffer = MutableString.CreateBinary(); } buffer.Clear(); if (!self.PreserveEndOfLines) { for (int i = 0; i < bytes; ++i) { int c = self.ReadByteNormalizeEoln(); if (c == -1) { return buffer; } else { buffer.Append((byte)c); } } } else { var fixedBuffer = new byte[bytes]; bytes = self.ReadBytes(fixedBuffer, 0, bytes); buffer.Append(fixedBuffer, 0, bytes); } return buffer; }
public static MutableString/*!*/ Read(RubyIO/*!*/ self) { self.AssertOpenedForReading(); if (!self.PreserveEndOfLines) { MutableString result = MutableString.CreateBinary(); int c; while ((c = self.ReadByteNormalizeEoln()) != -1) { result.Append((byte)c); } return result; } else { // TODO: change this once Binary mutable string uses resizable byte[] instead of List<byte> return MutableString.CreateBinary(ReadAllBytes(self)); } }