Package java.io

Examples of java.io.PipedOutputStream


    this.format = format;
    this.targetType = targetType;
    this.file = file;

    // Write to the output stream
    pos = new PipedOutputStream();

    // It will then go to the file via the input streams
    pis = new PipedInputStream(pos);
    ais = new AudioInputStream(pis, format, AudioSystem.NOT_SPECIFIED);
   
View Full Code Here


          if (aTypes[i].getExtension().equals(extension))
            targetType = aTypes[i];
      }

      // Write to the output stream
      pos = new PipedOutputStream();

      // It will then go to the file via the input streams
      pis = new PipedInputStream(pos);
      ais = new AudioInputStream(pis, format, AudioSystem.NOT_SPECIFIED);
View Full Code Here

    this.format = format;
    this.targetType = targetType;
    this.file = file;

    // Write to the output stream
    pos = new PipedOutputStream();

    // It will then go to the file via the input streams
    pis = new PipedInputStream(pos);
    ais = new AudioInputStream(pis, format, AudioSystem.NOT_SPECIFIED);
View Full Code Here

    public SessionTerminal(final CommandProcessor commandProcessor, final String user) throws IOException {
        try {
            this.terminal = new Terminal(GogoPlugin.TERM_WIDTH, GogoPlugin.TERM_HEIGHT);
            terminal.write("\u001b\u005B20\u0068"); // set newline mode on

            in = new PipedOutputStream();
            out = new PipedInputStream();
            PrintStream pipedOut = new PrintStream(new PipedOutputStream(out), true);

            console = new Console(commandProcessor, new PipedInputStream(in), pipedOut, pipedOut, new Runnable() {
                public void run() {
                    SessionTerminal.this.terminal.write("done...");
                    close();
View Full Code Here

    public Pipe connect(Pipe next) throws IOException
    {
        next.setOut(out);
        next.setErr(err);
        pout = new PipedOutputStream();
        next.setIn(new PipedInputStream(pout));
        out = new PrintStream(pout);
        return next;
    }
View Full Code Here

      }
    });

    // create the recognizer pipe
    pin = new PipedInputStream();
    pout = new PipedOutputStream();

    try {
      pout.connect(pin);
    } catch (IOException e) {
      System.err.println("URLFilter: error installing recognizer: " + e);
View Full Code Here

public class ProtocolTest extends JedisTestBase {
    @Test
    public void buildACommand() throws IOException {
  PipedInputStream pis = new PipedInputStream();
  BufferedInputStream bis = new BufferedInputStream(pis);
  PipedOutputStream pos = new PipedOutputStream(pis);
  RedisOutputStream ros = new RedisOutputStream(pos);

  Protocol.sendCommand(ros, Protocol.Command.GET,
    "SOMEKEY".getBytes(Protocol.CHARSET));
  ros.flush();
  pos.close();
  String expectedCommand = "*2\r\n$3\r\nGET\r\n$7\r\nSOMEKEY\r\n";

  int b;
  StringBuilder sb = new StringBuilder();
  while ((b = bis.read()) != -1) {
View Full Code Here

    PipedOutputStream toStdin;
    PipedInputStream fromStdout;
    ByteArrayOutputStream stderr;

    public ScpChannel(ClientSession clientSession, String cmd) throws IOException {
      this.toStdin = new PipedOutputStream();
      this.fromStdout = new PipedInputStream();

      log.debug("SCP Opening channel for cmd: " + cmd);

      try {
        channel = BugFixChannelExec.createExecChannel(clientSession, cmd, false);
      } catch (Exception e1) {
        throw new IOException("Cannot create channel", e1);
      }

      this.stderr = new ByteArrayOutputStream();

      channel.setIn(new PipedInputStream(toStdin));
      channel.setOut(new PipedOutputStream(fromStdout));
      channel.setErr(stderr);
    }
View Full Code Here

        wrapper = null;
      } else if(ctype == COMPRESSOR_TYPE.LZMA_NEW) {
        // LZMA internally uses pipe streams, so we may as well do it here.
        // In fact we need to for LZMA_NEW, because of the properties bytes.
        PipedInputStream pis = new PipedInputStream();
        PipedOutputStream pos = new PipedOutputStream();
        pis.connect(pos);
        final OutputStream os = new BufferedOutputStream(pos);
        wrapper = new ExceptionWrapper();
        context.mainExecutor.execute(new Runnable() {
View Full Code Here

    // Variables will be updated on exit of method, and the only thing that is
    // set is the returnBucket and the result. Not locking not only prevents
    // nested locking resulting in deadlocks, it also prevents long locks due to
    // doing massive encrypted I/Os while holding a lock.

    PipedOutputStream dataOutput = new PipedOutputStream();
    PipedInputStream dataInput = new PipedInputStream();
    OutputStream output = null;

    DecompressorThreadManager decompressorManager = null;
    ClientGetWorkerThread worker = null;
    Bucket finalResult = null;
    FetchResult result = null;

        long maxLen = -1;
        synchronized(this) {
            if(expectedSize > 0) {
                maxLen = expectedSize;
            }
        }
        if(ctx.filterData && maxLen >= 0) {
            maxLen = expectedSize * 2 + 1024;
        }
        if(maxLen == -1) {
            maxLen = Math.max(ctx.maxTempLength, ctx.maxOutputLength);
        }
       
    FetchException ex = null; // set on failure
    try {
      if(returnBucket == null) finalResult = context.getBucketFactory(persistent()).makeBucket(maxLen);
      else finalResult = returnBucket;
      if(logMINOR) Logger.minor(this, "Writing final data to "+finalResult+" return bucket is "+returnBucket);
      dataOutput .connect(dataInput);
      result = new FetchResult(clientMetadata, finalResult);

      // Decompress
      if(decompressors != null) {
        if(logMINOR) Logger.minor(this, "Decompressing...");
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.