GetStream() public method

public GetStream ( ) : RubyBufferedStream
return RubyBufferedStream
示例#1
0
文件: IoOps.cs 项目: ltwlf/IronSP
 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);
 }
示例#2
0
文件: IoOps.cs 项目: ltwlf/IronSP
        public static bool IsAtty(RubyIO /*!*/ self)
        {
            ConsoleStreamType?console = self.ConsoleStreamType;

            if (console == null)
            {
                return(self.GetStream().BaseStream == Stream.Null);
            }

            int fd = GetStdHandleFd(console.Value);

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
            case PlatformID.Win32Windows:
            case PlatformID.WinCE:
                IntPtr handle = GetStdHandle(fd);
                if (handle == IntPtr.Zero)
                {
                    throw new Win32Exception();
                }

                return(GetFileType(handle) == FILE_TYPE_CHAR);

            default:
                return(isatty(fd) == 1);
            }
        }
示例#3
0
文件: IoOps.cs 项目: ltwlf/IronSP
        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);
        }
示例#4
0
        public static bool IsAtty(RubyIO/*!*/ self) {
            ConsoleStreamType? console = self.ConsoleStreamType;
            if (console == null) {
                return self.GetStream().BaseStream == Stream.Null;
            }

            int fd = GetStdHandleFd(console.Value);
            switch (Environment.OSVersion.Platform) {
                case PlatformID.Win32NT:
                case PlatformID.Win32S:
                case PlatformID.Win32Windows:
                case PlatformID.WinCE:
                    IntPtr handle = GetStdHandle(fd);
                    if (handle == IntPtr.Zero) {
                        throw new Win32Exception();
                    }

                    return GetFileType(handle) == FILE_TYPE_CHAR;

                default:
                    return isatty(fd) == 1;
            }
        }