Package org.jruby.util.io

Examples of org.jruby.util.io.OpenFile.checkReadable()


    public int getcCommon() {
        try {
            OpenFile myOpenFile = getOpenFileChecked();

            myOpenFile.checkReadable(getRuntime());
            myOpenFile.setReadBuffered();

            Stream stream = myOpenFile.getMainStreamSafe();
           
            readCheck(stream);
View Full Code Here


        string.empty();
        string.setTaint(true);
       
        try {
            OpenFile myOpenFile = getOpenFileChecked();
            myOpenFile.checkReadable(runtime);
           
            if (length == 0) {
                return string;
            }
View Full Code Here

                buffer.length(0);
            }
           
            OpenFile myOpenFile = getOpenFileChecked();
           
            myOpenFile.checkReadable(getRuntime());
           
            if (myOpenFile.getMainStreamSafe().readDataBuffered()) {
                throw getRuntime().newIOError("sysread for buffered IO");
            }
           
View Full Code Here

    public IRubyObject read(ThreadContext context) {
        Ruby runtime = context.getRuntime();
        OpenFile myOpenFile = getOpenFileChecked();
       
        try {
            myOpenFile.checkReadable(runtime);
            myOpenFile.setReadBuffered();
            return readAll();
        } catch (InvalidValueException ex) {
            throw getRuntime().newErrnoEINVALError();
        } catch (EOFException ex) {
View Full Code Here

    public IRubyObject read(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
        OpenFile myOpenFile = getOpenFileChecked();
       
        if (arg0.isNil()) {
            try {
                myOpenFile.checkReadable(getRuntime());
                myOpenFile.setReadBuffered();
                if (arg1.isNil()) {
                    return readAll();
                } else {
                    return readAll(arg1.convertToString());
View Full Code Here

       
      try {
            OpenFile myOpenFile = getOpenFileChecked();
           
            while (true) {
                myOpenFile.checkReadable(runtime);
                myOpenFile.setReadBuffered();
                waitReadable(myOpenFile.getMainStream());
               
                int c = myOpenFile.getMainStreamSafe().fgetc();
               
View Full Code Here

        Ruby runtime = context.getRuntime();
        try {
            OpenFile openFile = ((RubyIO) src).getOpenFile();
            openFile.checkClosed(runtime);
            openFile.checkReadable(runtime);

            ChannelStream stream = (ChannelStream) openFile.getMainStreamSafe();

            ByteBuffer buffer = ((AbstractMemory) dst).getMemoryIO().asByteBuffer();
            int count = RubyNumeric.num2int(rbLength);
View Full Code Here

        Ruby runtime = context.runtime;
        try {
            OpenFile openFile = ((RubyIO) src).getOpenFile();
            openFile.checkClosed(runtime);
            openFile.checkReadable(runtime);

            ChannelStream stream = (ChannelStream) openFile.getMainStreamSafe();

            ByteBuffer buffer = ((AbstractMemory) dst).getMemoryIO().asByteBuffer();
            int count = RubyNumeric.num2int(rbLength);
View Full Code Here

        try {
            boolean is19 = runtime.is1_9();
           
            OpenFile myOpenFile = getOpenFileChecked();

            myOpenFile.checkReadable(runtime);
            myOpenFile.setReadBuffered();

            boolean isParagraph = separator == Stream.PARAGRAPH_DELIMETER;
            separator = isParagraph ? Stream.PARAGRAPH_SEPARATOR : separator;
           
View Full Code Here

        Ruby runtime = context.runtime;
       
        try {
            OpenFile myOpenFile = getOpenFileChecked();

            myOpenFile.checkReadable(runtime);
            myOpenFile.setReadBuffered();

            if (myOpenFile.getMainStreamSafe().feof()) {
                return runtime.getTrue();
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.