Package java.io

Examples of java.io.PipedInputStream.connect()


    String  get = "/download/" + getURL().toString().substring( 7 ) + " HTTP/1.0" + NL + NL;
   
    PipedOutputStream   pos = new PipedOutputStream();
    PipedInputStream   pis = new PipedInputStream();
   
    pis.connect( pos );
   
    input_stream  = pis;
    output_stream   = pos;
   
    MagnetURIHandler.getSingleton().process( get, new ByteArrayInputStream(new byte[0]), pos );
View Full Code Here


  public LogisimFile cloneLogisimFile(Loader newloader) {
    PipedInputStream reader = new PipedInputStream();
    PipedOutputStream writer = new PipedOutputStream();
    try {
      reader.connect(writer);
    } catch (IOException e) {
      newloader.showError(StringUtil.format(
        Strings.get("fileDuplicateError"), e.toString()));
      return null;
    }
View Full Code Here

      } 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() {

          @Override
View Full Code Here

      try {
        finalData = context.getBucketFactory(persistent).makeBucket(maxLen);
        output = finalData.getOutputStream();
        if(decompressors != null) {
          if(logMINOR) Logger.minor(this, "decompressing...");
          pipeIn.connect(pipeOut);
          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);
View Full Code Here

                        // the previous stage is sending stdout to the pipe
                        if (in == CommandLine.DEFAULT_STDIN) {
                            // this stage is going to read from the pipe
                            PipedInputStream pipeIn = new PipedInputStream();
                            try {
                                pipeIn.connect(pipeOut);
                            } catch (IOException ex) {
                                throw new ShellInvocationException(
                                        "Problem connecting pipe", ex);
                            }
                            in = new CommandInput(pipeIn);
View Full Code Here

   */
  public InputStream getInputStream() throws Exception {
    final PipedOutputStream os = new PipedOutputStream();
    final PipedInputStream is = new PipedInputStream();

    is.connect(os);

    Thread thread1 = new Thread() {

      @Override
      public void run() {
View Full Code Here

    protected InputStream convert(org.w3c.dom.Document edoc) throws IOException {

        final org.w3c.dom.Document doc = edoc;
        final PipedOutputStream pos = new PipedOutputStream();
        PipedInputStream pis = new PipedInputStream();
        pis.connect(pos);

        (new Thread(new Runnable() {

            public void run() {
                try {
View Full Code Here

    protected InputStream convert(org.w3c.dom.Document edoc) throws IOException {

        final org.w3c.dom.Document doc = edoc;
        final PipedOutputStream pos = new PipedOutputStream();
        PipedInputStream pis = new PipedInputStream();
        pis.connect(pos);

        (new Thread(new Runnable() {

            public void run() {
                try {
View Full Code Here

    public void test_hasNextLine_sequence() throws IOException {
        final PipedInputStream pis = new PipedInputStream();
        final PipedOutputStream pos = new PipedOutputStream();
        final Scanner scanner = new Scanner(pis);
        pis.connect(pos);
        final List<String> result = new ArrayList<String>();
        Thread thread = new Thread(new Runnable() {
            public void run() {
                while (scanner.hasNextLine()) {
                    result.add(scanner.nextLine());
View Full Code Here

   {@link PresenceVector#write(java.io.DataOutput)}.
   */
  public void testSerialization() throws Exception {
    PipedInputStream pipedIn = new PipedInputStream();
    PipedOutputStream pipedOut = new PipedOutputStream();
    pipedIn.connect(pipedOut);
   
    DataInput in = new DataInputStream(pipedIn);
    DataOutput out = new DataOutputStream(pipedOut);
   
    PresenceVector pv = new PresenceVector(2);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.