GetFileDescriptor() public method

public GetFileDescriptor ( ) : int
return int
Beispiel #1
0
 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);
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 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;
 }
Beispiel #5
0
 public static int FileNo(RubyIO/*!*/ self) {
     return self.GetFileDescriptor();
 }
Beispiel #6
0
        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;
        }
Beispiel #7
0
 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;
 }
Beispiel #8
0
 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;
 }
Beispiel #9
0
 public static int FileNo(RubyIO /*!*/ self)
 {
     return(self.GetFileDescriptor());
 }