Package pushy

Examples of pushy.PushyObject


    public RemoteSocket socket(int family, int type) {
        return socket(family, type, 0);
    }

    public RemoteSocket socket(int family, int type, int protocol) {
        PushyObject socketObject =
            (PushyObject)socketMethod.__call__(new Object[]{
                new Integer(family),
                new Integer(type),
                new Integer(protocol)});
        return new RemoteSocket(client, socketObject);
View Full Code Here


            }
            remoteEnv.putAll(env);
            kwargs.put("env", remoteEnv);
        }

        PushyObject popen = (PushyObject)Popen.__call__(args, kwargs);
        return new JPushyProcess(client, popen, osModule, signalModule,
                                 combineStderrStdout);
    }
View Full Code Here

        super(getInputStream(client, path), charset.newDecoder());
    }

    private static InputStream getInputStream(Client client, String path) {
        Module builtin = client.getModule("__builtin__");
        PushyObject open = (PushyObject)builtin.__getattr__("open");
        PushyObject file =
            (PushyObject)open.__call__(new String[]{path, "r"});
        return new FileInputStream(file);
    }
View Full Code Here

    }

    // Open a file in the remote interpreter.
    private static PushyObject open(Client client, String path, String mode) {
        Module builtin = client.getModule("__builtin__");
        PushyObject open = (PushyObject)builtin.__getattr__("open");
        return (PushyObject)open.__call__(new String[]{path, mode});
    }
View Full Code Here

        InetSocketAddress socketAddress = (InetSocketAddress)bindpoint;
        InetAddress address = socketAddress.getAddress();

        // Call the bind() method.
        PushyObject bindMethod = (PushyObject)object.__getattr__("bind");
        try {
            bindMethod.__call__(new Object[]{
                new Object[]{
                    address.getHostAddress(),
                    new Integer(socketAddress.getPort())
            }});
            bound = true;
View Full Code Here

    public synchronized int getLocalPort()
    {
        if (!isClosed())
        {
            PushyObject getsockname =
                (PushyObject)object.__getattr__("getsockname");
            Object[] address = (Object[])getsockname.__call__();
            return ((Number)address[1]).intValue();
        }
        return -1; // TODO check if this is what "real" Java does.
    }
View Full Code Here

     */
    public synchronized SocketAddress getRemoteSocketAddress()
    {
        if (!isClosed())
        {
            PushyObject getpeername =
                (PushyObject)object.__getattr__("getpeername");
            Object[] address = (Object[])getpeername.__call__();
            if (address.length == 2)
            {
                String host = (String)address[0];
                int port = ((Integer)address[1]).intValue();
                return InetSocketAddress.createUnresolved(host, port);
View Full Code Here

        return null;
    }

    public void listen(int backlog)
    {
        PushyObject listen = (PushyObject)object.__getattr__("listen");
        listen.__call__(new Object[]{new Integer(backlog)});
    }
View Full Code Here

        if (!isConnected())
            throw new SocketException("Socket is not connected");
        if (!isInputShutdown)
        {
            SocketModule module = (SocketModule)client.getModule("socket");
            PushyObject shutdown = (PushyObject)object.__getattr__("shutdown");
            Object SHUT_WR = module.__getattr__("SHUT_WR");
            shutdown.__call__(new Object[]{SHUT_WR});
            if (inputStream != null)
                inputStream.close();
            inputStream = null;
            isInputShutdown = true;
        }
View Full Code Here

        if (!isConnected())
            throw new SocketException("Socket is not connected");
        if (!isOutputShutdown)
        {
            SocketModule module = (SocketModule)client.getModule("socket");
            PushyObject shutdown = (PushyObject)object.__getattr__("shutdown");
            Object SHUT_WR = module.__getattr__("SHUT_RD");
            shutdown.__call__(new Object[]{SHUT_WR});
            isOutputShutdown = true;
        }
    }
View Full Code Here

TOP

Related Classes of pushy.PushyObject

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.