Package org.perl6.nqp.sixmodel.reprs

Examples of org.perl6.nqp.sixmodel.reprs.IOHandleInstance


        return written;
    }

    public static SixModelObject flushfh(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOSyncWritable)
                ((IIOSyncWritable)h.handle).flush(tc);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support flush");
View Full Code Here


        return obj;
    }

    public static String readlinefh(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOSyncReadable)
                return ((IIOSyncReadable)h.handle).readline(tc);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support readline");
View Full Code Here

        }
    }

    public static String readlineintfh(SixModelObject obj, String prompt, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOInteractive)
                return ((IIOInteractive)h.handle).readlineInteractive(tc, prompt);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support readline interactive");
View Full Code Here

        }
    }

    public static String readallfh(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOSyncReadable)
                return ((IIOSyncReadable)h.handle).slurp(tc);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support slurp");
View Full Code Here

        }
    }

    public static String getcfh(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOSyncReadable)
                return ((IIOSyncReadable)h.handle).getc(tc);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support getc");
View Full Code Here

        }
    }

    public static long eoffh(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOSyncReadable)
                return ((IIOSyncReadable)h.handle).eof(tc) ? 1 : 0;
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support eof");
View Full Code Here

    }

    public static SixModelObject slurpasync(SixModelObject obj, SixModelObject resultType,
            SixModelObject done, SixModelObject error, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOAsyncReadable)
                ((IIOAsyncReadable)h.handle).slurp(tc, resultType, done, error);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support async slurp");
View Full Code Here

    }

    public static SixModelObject spurtasync(SixModelObject obj, SixModelObject resultType, SixModelObject data,
            SixModelObject done, SixModelObject error, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOAsyncWritable)
                ((IIOAsyncWritable)h.handle).spurt(tc, resultType, data, done, error);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support async spurt");
View Full Code Here

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static SixModelObject linesasync(SixModelObject obj, SixModelObject resultType,
            long chomp, SixModelObject queue, SixModelObject done, SixModelObject error,
            ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOAsyncReadable)
                ((IIOAsyncReadable)h.handle).lines(tc, resultType, chomp != 0,
                    (LinkedBlockingQueue)((JavaObjectWrapper)queue).theObject,
                    done, error);
            else
View Full Code Here

        return obj;
    }

    public static SixModelObject closefh(SixModelObject obj, ThreadContext tc) {
        if (obj instanceof IOHandleInstance) {
            IOHandleInstance h = (IOHandleInstance)obj;
            if (h.handle instanceof IIOClosable)
                ((IIOClosable)h.handle).close(tc);
            else
                throw ExceptionHandling.dieInternal(tc,
                    "This handle does not support close");
View Full Code Here

TOP

Related Classes of org.perl6.nqp.sixmodel.reprs.IOHandleInstance

Copyright © 2018 www.massapicom. 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.