Package net.schmizz.sshj.common

Examples of net.schmizz.sshj.common.StreamCopier$Listener


        protected void start()
                throws IOException {
            socket.setSendBufferSize(getLocalMaxPacketSize());
            socket.setReceiveBufferSize(getRemoteMaxPacketSize());
            final Event<IOException> soc2chan = new StreamCopier(socket.getInputStream(), getOutputStream())
                    .bufSize(getRemoteMaxPacketSize())
                    .spawnDaemon("soc2chan");
            final Event<IOException> chan2soc = new StreamCopier(getInputStream(), socket.getOutputStream())
                    .bufSize(getLocalMaxPacketSize())
                    .spawnDaemon("chan2soc");
            SocketStreamCopyMonitor.monitor(5, TimeUnit.SECONDS, soc2chan, chan2soc, this, socket);
        }
View Full Code Here


        scp.getOutputStream().flush();
    }

    long transferToRemote(StreamCopier.Listener listener, InputStream src, long length)
            throws IOException {
        return new StreamCopier(src, scp.getOutputStream())
                .bufSize(scp.getRemoteMaxPacketSize()).length(length)
                .keepFlushing(false)
                .listener(listener)
                .copy();
    }
View Full Code Here

                .copy();
    }

    long transferFromRemote(StreamCopier.Listener listener, OutputStream dest, long length)
            throws IOException {
        return new StreamCopier(scp.getInputStream(), dest)
                .bufSize(scp.getLocalMaxPacketSize()).length(length)
                .keepFlushing(false)
                .listener(listener)
                .copy();
    }
View Full Code Here

                session.allocateDefaultPTY();

                final Shell shell = session.startShell();

                new StreamCopier(shell.getInputStream(), System.out)
                        .bufSize(shell.getLocalMaxPacketSize())
                        .spawn("stdout");

                new StreamCopier(shell.getErrorStream(), System.err)
                        .bufSize(shell.getLocalMaxPacketSize())
                        .spawn("stderr");

                // Now make System.in act as stdin. To exit, hit Ctrl+D (since that results in an EOF on System.in)
                // This is kinda messy because java only allows console input after you hit return
                // But this is just an example... a GUI app could implement a proper PTY
                new StreamCopier(System.in, shell.getOutputStream())
                        .bufSize(shell.getRemoteMaxPacketSize())
                        .copy();

            } finally {
                session.close();
View Full Code Here

        sock.connect(addr);

        // ok so far -- could connect, let's confirm the channel
        chan.confirm();

        final Event<IOException> soc2chan = new StreamCopier(sock.getInputStream(), chan.getOutputStream())
                .bufSize(chan.getRemoteMaxPacketSize())
                .spawnDaemon("soc2chan");

        final Event<IOException> chan2soc = new StreamCopier(chan.getInputStream(), sock.getOutputStream())
                .bufSize(chan.getLocalMaxPacketSize())
                .spawnDaemon("chan2soc");

        SocketStreamCopyMonitor.monitor(5, TimeUnit.SECONDS, chan2soc, soc2chan, chan, sock);
    }
View Full Code Here

            final RemoteFile rf = engine.open(remote.getPath());
            try {
                final RemoteFile.RemoteFileInputStream rfis = rf.new RemoteFileInputStream();
                final OutputStream os = adjusted.getOutputStream();
                try {
                    new StreamCopier(rfis, os)
                            .bufSize(engine.getSubsystem().getLocalMaxPacketSize())
                            .keepFlushing(false)
                            .listener(listener)
                            .copy();
                } finally {
View Full Code Here

                                                                   OpenMode.TRUNC));
            try {
                final InputStream fis = local.getInputStream();
                final RemoteFile.RemoteFileOutputStream rfos = rf.new RemoteFileOutputStream(0, 16);
                try {
                    new StreamCopier(fis, rfos)
                            .bufSize(engine.getSubsystem().getRemoteMaxPacketSize() - rf.getOutgoingPacketOverhead())
                            .keepFlushing(false)
                            .listener(listener)
                            .copy();
                } finally {
View Full Code Here

        final XMLBeansModel model = new XMLBeansModel(Factory.parse(is).getJbossesb());
       
        final List<Listener> awareListeners = model.getESBAwareListeners() ;
        assertEquals("Listener count", 1, awareListeners.size()) ;
       
        final Listener listener = awareListeners.get(0) ;
        assertTrue("JmsListener", listener instanceof JmsListener) ;
       
        final Document doc = YADOMUtil.createDocument() ;
        final Element root = doc.createElement("root") ;
        final Element listenerElement = JmsListenerMapper.map(root, (JmsListener)listener, model) ;
View Full Code Here

    JmsMessageFilter listenerDestination = awareListener.getJmsMessageFilter();
    assertEquals("queue/B", listenerDestination.getDestName());
    assertEquals(JmsMessageFilter.DestType.TOPIC, listenerDestination.getDestType());
    assertEquals("service='Reconciliation'", listenerDestination.getSelector());

    Listener untypedAwareListener = awareListeners.get(1);
    assertEquals("Bank-Listener-Generic", untypedAwareListener.getName());
    assertEquals("my-generic-bus", untypedAwareListener.getBusidref());
    assertTrue(!untypedAwareListener.getIsGateway());

    Service gatewayService = model.getService(gatewayListener);
    Service awareService = model.getService(awareListener);
    assertSame(gatewayService, awareService);
    assertEquals("Bank", awareService.getCategory());
View Full Code Here

        final XMLBeansModel model = new XMLBeansModel(Factory.parse(is).getJbossesb());
       
        final List<Listener> awareListeners = model.getESBAwareListeners() ;
        assertEquals("Listener count", 1, awareListeners.size()) ;
       
        final Listener listener = awareListeners.get(0) ;
        assertTrue("JmsListener", listener instanceof JmsListener) ;
       
        final Document doc = YADOMUtil.createDocument() ;
        final Element root = doc.createElement("root") ;
        final Element listenerElement = JmsListenerMapper.map(root, (JmsListener)listener, model) ;
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.common.StreamCopier$Listener

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.