SetStream() public method

public SetStream ( Stream stream ) : void
stream Stream
return void
Example #1
0
 public static RubyIO /*!*/ Reinitialize(RubyIO /*!*/ self, [DefaultProtocol] int descriptor, int mode)
 {
     self.Mode = (IOMode)mode;
     self.SetStream(GetDescriptorStream(self.Context, descriptor));
     self.SetFileDescriptor(descriptor);
     return(self);
 }
Example #2
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);
 }
Example #3
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);
        }
Example #4
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);
        }
Example #5
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;
        }
Example #6
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;
 }
Example #7
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;
            self.ExternalEncoding = source.ExternalEncoding;
            self.InternalEncoding = source.InternalEncoding;
            return self;
        }
Example #8
0
        internal static RubyIO/*!*/ Reinitialize(RubyIO/*!*/ io, int descriptor, IOInfo info) {
            io.Mode = info.Mode;
            io.SetStream(GetDescriptorStream(io.Context, descriptor));
            io.SetFileDescriptor(descriptor);

            if (info.HasEncoding) {
                io.ExternalEncoding = info.ExternalEncoding;
                io.InternalEncoding = info.InternalEncoding;
            }

            return io;
        }
Example #9
0
 public static RubyIO/*!*/ Reinitialize(RubyIO/*!*/ self, [DefaultProtocol]int descriptor, int mode) {
     self.Mode = (IOMode)mode;
     self.SetStream(GetDescriptorStream(self.Context, descriptor));
     self.SetFileDescriptor(descriptor);
     return self;
 }
Example #10
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;
 }