Package java.io

Examples of java.io.PipedOutputStream


            final ClientSession session = client.connect("localhost", 4222).await().getSession();
            session.authPassword("jonathan", "secret");

            final ClientChannel channel = session.createChannel("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();

            pipedIn.write("properties\r\n".getBytes());
            pipedIn.flush();

            pipedIn.write("exit\r\n".getBytes());
            pipedIn.flush();

            channel.waitFor(ClientChannel.CLOSED, 0);
            channel.close(false);
            client.stop();
View Full Code Here


    private List<CachedOutputStreamCallback> callbacks;
   
    private List<Object> streamList = new ArrayList<Object>();

    public CachedOutputStream(PipedInputStream stream) throws IOException {
        currentStream = new PipedOutputStream(stream);
        inmem = true;
    }
View Full Code Here

                    ByteArrayOutputStream byteOut = (ByteArrayOutputStream) currentStream;
                    if (copyOldContent && byteOut.size() > 0) {
                        byteOut.writeTo(out);
                    }
                } else if (currentStream instanceof PipedOutputStream) {
                    PipedOutputStream pipeOut = (PipedOutputStream) currentStream;
                    IOUtils.copyAndCloseInput(new PipedInputStream(pipeOut), out);
                } else {
                    throw new IOException("Unknown format of currentStream");
                }
            } else {
View Full Code Here

    // See PIG-1285
    @Test
    public void testSerializeSingleTupleBag() throws Exception {
        Tuple t = Util.createTuple(new String[] {"foo", "bar", "baz"});
        DataBag stBag = new SingleTupleBag(t);
        PipedOutputStream pos = new PipedOutputStream();
        DataOutputStream dos = new DataOutputStream(pos);
        PipedInputStream pis = new PipedInputStream(pos);
        DataInputStream dis = new DataInputStream(pis);
        stBag.write(dos);
        DataBag dfBag = new DefaultDataBag();
View Full Code Here

            //os = channel.getOutputStream();
            channel.setHost(((InetSocketAddress) address).getHostName());
            channel.setPort(((InetSocketAddress) address).getPort());
            channel.setOrgPort(22);
            is = new PipedInputStream();
            os = new PipedOutputStream();
            channel
                    .setInputStream(new PipedInputStream((PipedOutputStream) os));
            channel
                    .setOutputStream(new PipedOutputStream(
                            (PipedInputStream) is));
            channel.connect();
            if (!channel.isConnected()) {
                log.error("Not connected");
            }
View Full Code Here

    private List<CachedOutputStreamCallback> callbacks;
   
    private List<Object> streamList = new ArrayList<Object>();

    public CachedOutputStream(PipedInputStream stream) throws IOException {
        currentStream = new PipedOutputStream(stream);
        inmem = true;
    }
View Full Code Here

                    ByteArrayOutputStream byteOut = (ByteArrayOutputStream) currentStream;
                    if (copyOldContent && byteOut.size() > 0) {
                        byteOut.writeTo(out);
                    }
                } else if (currentStream instanceof PipedOutputStream) {
                    PipedOutputStream pipeOut = (PipedOutputStream) currentStream;
                    IOUtils.copyAndCloseInput(new PipedInputStream(pipeOut), out);
                } else {
                    throw new IOException("Unknown format of currentStream");
                }
            } else {
View Full Code Here

    private List<CachedOutputStreamCallback> callbacks;
   
    private List<Object> streamList = new ArrayList<Object>();

    public CachedOutputStream(PipedInputStream stream) throws IOException {
        currentStream = new PipedOutputStream(stream);
        inmem = true;
    }
View Full Code Here

                    ByteArrayOutputStream byteOut = (ByteArrayOutputStream) currentStream;
                    if (copyOldContent && byteOut.size() > 0) {
                        byteOut.writeTo(out);
                    }
                } else if (currentStream instanceof PipedOutputStream) {
                    PipedOutputStream pipeOut = (PipedOutputStream) currentStream;
                    IOUtils.copyAndCloseInput(new PipedInputStream(pipeOut), out);
                } else {
                    throw new IOException("Unknown format of currentStream");
                }
            } else {
View Full Code Here

    // make  sure popup menu  follows  Look & Feel
    UIManager.addPropertyChangeListener(this);

    outPipe  = cout;
    if ( outPipe ==  null ) {
      outPipe  = new PipedOutputStream();
      try {
        in = new PipedInputStream((PipedOutputStream)outPipe);
      } catch  ( IOException e  ) {
        print("Console internal  error (1)...", Color.red);
      }
    }

    inPipe = cin;
    if ( inPipe == null ) {
      PipedOutputStream pout = new PipedOutputStream();
      out = new PrintStream( pout );
      try {
        inPipe = new BlockingPipedInputStream(pout);
      } catch ( IOException e ) { print("Console internal error: "+e); }
    }
View Full Code Here

TOP

Related Classes of java.io.PipedOutputStream

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.