Package java.io

Examples of java.io.PipedInputStream.available()


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

View Full Code Here


        os.flush();

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

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

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

        Thread.sleep(1000);

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

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

View Full Code Here

        // Writing another byte would cause the write to wait
        // for a read before returning
        for (int i = 0; i < 1024; i++) {
            pout.write(i);
        }
        assertEquals("Incorrect available count", 1024, pin.available());
    }

    /**
     * @tests java.io.PipedInputStream#close()
     */
 
View Full Code Here

        // Writing another byte would cause the write to wait
        // for a read before returning
        for (int i = 0; i < 1024; i++) {
            pout.write(i);
        }
        assertEquals("Incorrect available count", 1024 , pin.available());
    }

  /**
   * @tests java.io.PipedInputStream#close()
   */
 
View Full Code Here

    String pattern = "List of all the available keys:";
    PipedOutputStream pipeOut = new PipedOutputStream();
    PipedInputStream pipeIn = new PipedInputStream(pipeOut);
    System.setErr(new PrintStream(pipeOut));
    jmx.printAllValues();
    if ((size = pipeIn.available()) != 0) {
      bytes = new byte[size];
      pipeIn.read(bytes, 0, bytes.length);           
    }
    pipeOut.close();
    pipeIn.close();
View Full Code Here

        // Writing another byte would cause the write to wait
        // for a read before returning
        for (int i = 0; i < 1024; i++) {
            pout.write(i);
        }
        assertEquals("Incorrect available count", 1024, pin.available());
    }

    /**
     * @tests java.io.PipedInputStream#close()
     */
 
View Full Code Here

            protected static final int PIPE_SIZE = 1024;
        };

        final PipedOutputStream outPipe = new PipedOutputStream(inPipe) {
            public void close() throws IOException {
                while (inPipe.available() > 0) {
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
View Full Code Here

      PipedOutputStream out = null;
      closeStream(out);
      out = new PipedOutputStream();
      PipedInputStream snk = new PipedInputStream();
      out.connect(snk);
      System.out.println(snk.available());
      writeUTF8(out, "This is so good");
      System.out.println(snk.available());
      assertEquals(15, snk.available());
  }
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.