Package java.io

Examples of java.io.PipedInputStream


            client.start();
            ClientSession session = client.connect("localhost", port).await().getSession();
            session.authPassword("smx", "smx");
            ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
            PipedOutputStream pipedIn = new PipedOutputStream();
            channel.setIn(new PipedInputStream(pipedIn));
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ByteArrayOutputStream err = new ByteArrayOutputStream();
            channel.setOut(out);
            channel.setErr(err);
            channel.open().await();
View Full Code Here


        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);

       
        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new TeePipedOutputStream(sent);
        channel.setIn(new PipedInputStream(pipedIn));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayOutputStream err = new ByteArrayOutputStream();
        channel.setOut(out);
        channel.setErr(err);
        channel.open();
View Full Code Here

        ClientSession session = client.connect("localhost", port).await().getSession();
        session.authPassword("smx", "smx");
        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new TeePipedOutputStream(sent);
        channel.setIn(new PipedInputStream(pipedIn));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayOutputStream err = new ByteArrayOutputStream();
        channel.setOut(out);
        channel.setErr(err);
        channel.open().await();
View Full Code Here

        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        session.close(false);

        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new TeePipedOutputStream(sent);
        channel.setIn(new PipedInputStream(pipedIn));
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayOutputStream err = new ByteArrayOutputStream();
        channel.setOut(out);
        channel.setErr(err);
        channel.open();
View Full Code Here

            ClientSession session = client.connect("localhost", port).await().getSession();
            session.authPassword("smx", "smx");
            ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
            ByteArrayOutputStream sent = new ByteArrayOutputStream();
            PipedOutputStream pipedIn = new TeePipedOutputStream(sent);
            channel.setIn(new PipedInputStream(pipedIn));
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ByteArrayOutputStream err = new ByteArrayOutputStream();
            channel.setOut(out);
            channel.setErr(err);
            channel.open().await();
View Full Code Here

    }
   
    @Before
    public void setUp() {
        try {
            pipeIn = new PipedInputStream();
            pipeOut = new CountingPipedOutputStream();
            pipeIn.connect(pipeOut);
            sender = new Sender();
            receiver = new Receiver();
            sender.start();
View Full Code Here

  private volatile boolean end;
 
  private static final String CONSOLE_NAME = "CONSOLE_MAVEN";

  public OutPutHandler() {
    InputStream in = new PipedInputStream();
    OutputStream out;
    try {
      out = new PipedOutputStream((PipedInputStream) in);
      printStream = new PrintStream(out);
    } catch (IOException e) {
View Full Code Here

          // Copy the input to the Base64 Encoder (in a seperate thread).
          Thread t = new StreamCopier(inIS, os);
         
          // Read that from the piped output stream.
          inIS = new PipedInputStream(pos);
          t.start();
        }

        if (action.equals("DECODE")||
            action.equals("ROUND")) {
View Full Code Here

        byte expected2[] = { 't', 'e', 's', 't', '2' };

        openConnections();

        PipedOutputStream po = new PipedOutputStream();
        PipedInputStream pi = new PipedInputStream(po);

        OutputStream os = server1.getOutputStream();
        OutputStream ostc = tc1.getOutputStream();

        tc1.registerSpyStream(po);

        os.write("test1".getBytes());
        os.flush();

        Thread.sleep(1000);
        byte buffer[] = new byte[5];

        if(pi.available() == 5)
        {
            pi.read(buffer);
            if(equalBytes(buffer, expected1))
                test1spy_ok = true;
        }

        ostc.write("test2".getBytes());
        ostc.flush();

        Thread.sleep(1000);

        if(pi.available() == 5)
        {
            pi.read(buffer);
            if(equalBytes(buffer, expected2))
                test2spy_ok = true;
        }

        tc1.stopSpyStream();
        os.write("test1".getBytes());
        os.flush();
        ostc.write("test2".getBytes());
        ostc.flush();
        Thread.sleep(1000);
        if(pi.available() == 0)
        {
            stopspy_ok = true;
        }

        closeConnections();
View Full Code Here

        assertTrue(expected.equals(f1.toDelimitedString(":")));

        // value read / write & marshalling
        PipedOutputStream pos = new PipedOutputStream();
        DataOutputStream dos = new DataOutputStream(pos);
        PipedInputStream pis = new PipedInputStream(pos);
        DataInputStream dis = new DataInputStream(pis);
        f1.write(dos);
        f1.write(dos);
        f2.readFields(dis);
        assertTrue(f1.equals(f2));
View Full Code Here

TOP

Related Classes of java.io.PipedInputStream

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.