Package java.io

Examples of java.io.PipedInputStream


      Logger.error(this, "Caught "+t, t);
      onFailure(new FetchException(FetchExceptionMode.INTERNAL_ERROR, t), state, context);
      return;
    }

    PipedInputStream pipeIn = null;
    PipedOutputStream pipeOut = null;
    try {
      output = finalResult.getOutputStream();
      // Decompress
      if(decompressors != null) {
        if(logMINOR) Logger.minor(this, "Decompressing...");
        pipeIn = new PipedInputStream();
        pipeOut = new PipedOutputStream(pipeIn);
        decompressorManager = new DecompressorThreadManager(pipeIn, decompressors, maxLen);
        pipeIn = decompressorManager.execute();
        ClientGetWorkerThread worker = new ClientGetWorkerThread(new BufferedInputStream(pipeIn), output, null, null, null, false, null, null, null, context.linkFilterExceptionProvider);
        worker.start();
View Full Code Here


    while(!decompressors.isEmpty()) {
      Compressor compressor = decompressors.remove(decompressors.size()-1);
      if(logMINOR) Logger.minor(this, "Decompressing with "+compressor);
      DecompressorThread thread = new DecompressorThread(compressor, this, input, output, maxLen);
      threads.add(thread);
      input = new PipedInputStream(output);
      output = new PipedOutputStream();
    }
  }
View Full Code Here

    }
   
    @Override
    public void onSuccess(StreamGenerator streamGenerator, ClientMetadata clientMetadata, List<? extends Compressor> decompressors, ClientGetState state, ClientContext context) {
      OutputStream output = null;
      PipedInputStream pipeIn = new PipedInputStream();
      PipedOutputStream pipeOut = new PipedOutputStream();
      Bucket data = null;
      // FIXME not strictly correct and unnecessary - archive size already checked against ctx.max*Length inside SingleFileFetcher
      long maxLen = Math.min(ctx.maxTempLength, ctx.maxOutputLength);
      try {
        data = context.getBucketFactory(persistent).makeBucket(maxLen);
        output = data.getOutputStream();
        if(decompressors != null) {
          if(logMINOR) Logger.minor(this, "decompressing...");
          pipeOut.connect(pipeIn);
          DecompressorThreadManager decompressorManager =  new DecompressorThreadManager(pipeIn, decompressors, maxLen);
          pipeIn = decompressorManager.execute();
          ClientGetWorkerThread worker = new ClientGetWorkerThread(new BufferedInputStream(pipeIn), output, null, null, null, false, null, null, null, context.linkFilterExceptionProvider);
          worker.start();
          streamGenerator.writeTo(pipeOut, context);
          decompressorManager.waitFinished();
          worker.waitFinished();
        } else streamGenerator.writeTo(output, context);
        // We want to see anything thrown when these are closed.
        output.close(); output = null;
        pipeOut.close(); pipeOut = null;
        pipeIn.close(); pipeIn = null;
      } catch (Throwable t) {
        Logger.error(this, "Caught "+t, t);
        onFailure(new FetchException(FetchExceptionMode.INTERNAL_ERROR, t), state, context);
        return;
      } finally {
View Full Code Here

            return this;
        }

        @Override
        protected FileListProvider openFileList(String targetName) throws IOException {
            final PipedInputStream remoteStdin = new PipedInputStream();
            final PipedOutputStream remoteStdout = new PipedOutputStream();
            final PipedOutputStream upstream = new PipedOutputStream(remoteStdin);
            final PipedInputStream downstream = new PipedInputStream(remoteStdout);

            final Future<Void> future = Executors.newFixedThreadPool(1).submit(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    Writer writer = FileList.createWriter(remoteStdout, false);
View Full Code Here

        protected FileListProvider openFileList(
                String targetName,
                String batchId,
                String jobflowId,
                String executionId) throws IOException {
            final PipedInputStream remoteStdin = new PipedInputStream();
            final PipedOutputStream remoteStdout = new PipedOutputStream();
            final PipedOutputStream upstream = new PipedOutputStream(remoteStdin);
            final PipedInputStream downstream = new PipedInputStream(remoteStdout);

            final Future<Void> future = Executors.newFixedThreadPool(1).submit(new Callable<Void>() {
                @Override
                public Void call() throws Exception {
                    Writer writer = FileList.createWriter(remoteStdout, false);
View Full Code Here

    }

    @Override
    protected void doOpen() throws IOException {
        out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA);
        in = new PipedInputStream(pipe);
    }
View Full Code Here

        session.authPassword("smx", "smx").await().isSuccess();
        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);

        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new PipedOutputStream();
        channel.setIn(new PipedInputStream(pipedIn));
        OutputStream teeOut = new TeeOutputStream(sent, pipedIn);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayOutputStream err = new ByteArrayOutputStream();
        channel.setOut(out);
        channel.setErr(err);
View Full Code Here


        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new PipedOutputStream();
        OutputStream teeOut = new TeeOutputStream(sent, pipedIn);
        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

        session.authPassword("smx", "smx");
        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        ByteArrayOutputStream sent = new ByteArrayOutputStream();
        PipedOutputStream pipedIn = new PipedOutputStream();
        OutputStream teeOut = new TeeOutputStream(sent, pipedIn);
        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

        session.authPassword("smx", "smx").await().isSuccess();
        ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL);
        session.close(false);

        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();
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.