Package java.io

Examples of java.io.PipedInputStream.available()


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

  @Test(expected=IOException.class)
  public void testWriteUTF8Error() throws IOException {
View Full Code Here


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

  @Test(expected=IOException.class)
  public void testWriteUTF8Error() throws IOException {
      OutputStream out = mock(OutputStream.class);
View Full Code Here

      PipedOutputStream out = null;
      closeStream(out);
      out = new PipedOutputStream();
      PipedInputStream snk = new PipedInputStream();
      out.connect(snk);
      System.out.println(snk.available());
      writeUTF8IgnoreException(out, "This is so good");
      System.out.println(snk.available());
      assertEquals(15, snk.available());
  }
View Full Code Here

      out = new PipedOutputStream();
      PipedInputStream snk = new PipedInputStream();
      out.connect(snk);
      System.out.println(snk.available());
      writeUTF8IgnoreException(out, "This is so good");
      System.out.println(snk.available());
      assertEquals(15, snk.available());
  }

  @Test
  public void testWriteUTF8IgnoreExceptionEx() throws Exception {
View Full Code Here

      PipedInputStream snk = new PipedInputStream();
      out.connect(snk);
      System.out.println(snk.available());
      writeUTF8IgnoreException(out, "This is so good");
      System.out.println(snk.available());
      assertEquals(15, snk.available());
  }

  @Test
  public void testWriteUTF8IgnoreExceptionEx() throws Exception {
      OutputStream out = mock(OutputStream.class);
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

        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

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.