IsConsoleDescriptor() public method

public IsConsoleDescriptor ( ) : bool
return bool
Ejemplo n.º 1
0
        private static void Seek(RubyIO /*!*/ self, long pos, int seekOrigin)
        {
            if (seekOrigin < 0 || seekOrigin > 2)
            {
                throw RubyExceptions.CreateArgumentError("Invalid argument");
            }

            if (self.IsConsoleDescriptor())
            {
                throw new Errno.BadFileDescriptorError();
            }

            // TODO: make sure we assert stream is not actually closed
            if (self.Closed)
            {
                throw RubyExceptions.CreateArgumentError("trying to seek on a non-existent stream?");
            }

            SeekOrigin origin = SeekOrigin.Current;

            if (seekOrigin == SEEK_SET)
            {
                origin = SeekOrigin.Begin;
            }
            else if (seekOrigin == SEEK_END)
            {
                origin = SeekOrigin.End;
            }

            self.Seek(pos, origin);
        }
Ejemplo n.º 2
0
        public static void Pos(RubyIO /*!*/ self, [DefaultProtocol] int value)
        {
            if (self.IsConsoleDescriptor())
            {
                throw new Errno.BadFileDescriptorError();
            }

            self.Seek(value, SeekOrigin.Begin);
        }
Ejemplo n.º 3
0
        public static object Pos(RubyIO /*!*/ self)
        {
            if (self.IsConsoleDescriptor())
            {
                throw new Errno.BadFileDescriptorError();
            }
            if (self.Closed)
            {
                throw RubyExceptions.CreateIOError("closed stream");
            }

            if (self.Position <= Int32.MaxValue)
            {
                return((int)self.Position);
            }

            return((BigInteger)self.Position);
        }
Ejemplo n.º 4
0
        public static void Pos(RubyIO/*!*/ self, [DefaultProtocol]int value) {
            if (self.IsConsoleDescriptor()) {
                throw new Errno.BadFileDescriptorError();
            }

            self.Seek(value, SeekOrigin.Begin);
        }
Ejemplo n.º 5
0
        public static object Pos(RubyIO/*!*/ self) {
            if (self.IsConsoleDescriptor()) {
                throw new Errno.BadFileDescriptorError();
            }
            if (self.Closed) {
                throw RubyExceptions.CreateIOError("closed stream");
            }

            if (self.Position <= Int32.MaxValue) {
                return (int)self.Position;
            }

            return (BigInteger)self.Position;
        }
Ejemplo n.º 6
0
        private static void Seek(RubyIO/*!*/ self, long pos, int seekOrigin) {
            if (seekOrigin < 0 || seekOrigin > 2) {
                throw RubyExceptions.CreateArgumentError("Invalid argument");
            }

            if (self.IsConsoleDescriptor()) {
                throw new Errno.BadFileDescriptorError();
            }

            // TODO: make sure we assert stream is not actually closed
            if (self.Closed) {
                throw RubyExceptions.CreateArgumentError("trying to seek on a non-existent stream?");
            }

            SeekOrigin origin = SeekOrigin.Current;
            if (seekOrigin == SEEK_SET) {
                origin = SeekOrigin.Begin;
            } else if (seekOrigin == SEEK_END) {
                origin = SeekOrigin.End;
            }

            self.Seek(pos, origin);
        }