public static RubyIO /*!*/ Reopen(RubyIO /*!*/ self, [NotNull] RubyIO /*!*/ source) { self.Context.RedirectFileDescriptor(self.GetFileDescriptor(), source.GetFileDescriptor()); self.SetStream(source.GetStream()); self.Mode = source.Mode; return(self); }
public static RubyIO /*!*/ Reopen(RubyIO /*!*/ self, [DefaultProtocol, NotNull] MutableString /*!*/ path, int mode) { Stream newStream = RubyFile.OpenFileStream(self.Context, path.ConvertToString(), (IOMode)mode); self.Context.SetStream(self.GetFileDescriptor(), newStream); self.SetStream(newStream); self.Mode = (IOMode)mode; return(self); }
public static RubyIO /*!*/ InitializeCopy(RubyIO /*!*/ self, [NotNull] RubyIO /*!*/ source) { Stream stream = source.GetStream(); int descriptor = self.Context.DuplicateFileDescriptor(source.GetFileDescriptor()); self.SetStream(stream); self.SetFileDescriptor(descriptor); self.Mode = source.Mode; return(self); }
public static MutableString/*!*/ Inspect(RubyIO/*!*/ self) { var result = MutableString.CreateMutable(self.Context.GetIdentifierEncoding()); result.Append("#<"); result.Append(self.Context.GetClassOf(self).GetName(self.Context)); result.Append(':'); if (self.Initialized) { switch (self.ConsoleStreamType) { case ConsoleStreamType.Input: result.Append("<STDIN>"); break; case ConsoleStreamType.Output: result.Append("<STDOUT>"); break; case ConsoleStreamType.ErrorOutput: result.Append("<STDERR>"); break; case null: result.Append("fd ").Append(self.GetFileDescriptor().ToString(CultureInfo.InvariantCulture)); break; } } else { RubyUtils.AppendFormatHexObjectId(result, RubyUtils.GetObjectId(self.Context, self)); } result.Append('>'); return result; }
public static int FileNo(RubyIO/*!*/ self) { return self.GetFileDescriptor(); }
private static RubyIO/*!*/ Reopen(ConversionStorage<MutableString>/*!*/ toPath, RubyIO/*!*/ io, object pathObj, IOInfo info) { MutableString path = Protocols.CastToPath(toPath, pathObj); Stream newStream = RubyFile.OpenFileStream(io.Context, path.ToString(path.Encoding.Encoding), info.Mode); io.Context.SetStream(io.GetFileDescriptor(), newStream); io.SetStream(newStream); io.Mode = info.Mode; if (info.HasEncoding) { io.ExternalEncoding = info.ExternalEncoding; io.InternalEncoding = info.InternalEncoding; } return io; }
public static RubyIO/*!*/ Reopen(RubyIO/*!*/ self, [NotNull]RubyIO/*!*/ source) { self.Context.RedirectFileDescriptor(self.GetFileDescriptor(), source.GetFileDescriptor()); self.SetStream(source.GetStream()); self.Mode = source.Mode; return self; }
public static RubyIO/*!*/ Reopen(RubyIO/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ path, int mode) { Stream newStream = RubyFile.OpenFileStream(self.Context, path.ConvertToString(), (IOMode)mode); self.Context.SetStream(self.GetFileDescriptor(), newStream); self.SetStream(newStream); self.Mode = (IOMode)mode; return self; }
public static int FileNo(RubyIO /*!*/ self) { return(self.GetFileDescriptor()); }