Examples of BufferInputStream


Examples of org.jboss.fresh.io.BufferInputStream

    // read image
    BufferedImage image = null;

    if (inType.equals(IMG_TYPE)) {
      BufferInputStream bis = new BufferInputStream(getStdIn());
      image = ImageIO.read(bis);
      bis.close();
    } else { // OBJ_TYPE
      Object obj = null;

      if (oin.hasNext()) {
        obj = oin.next();
View Full Code Here

Examples of org.jboss.fresh.io.BufferInputStream

    try {
      //String args = StringUtils.toStringList(Arrays.asList(params), false);

      Process proc = Runtime.getRuntime().exec(params);

      BufferInputStream sin = new BufferInputStream(getStdIn());
      sin.setTimeout(1000);
      OutputStream nout = new BufferedOutputStream(proc.getOutputStream());
      final OutputStream sout = new BufferOutputStream(getStdOut());
      final InputStream nis = new BufferedInputStream(proc.getInputStream(), 80);

      // now copy from in to out and copy from out to in. This is not very nice
      // we need two threads
      Thread treader = new Thread() {
        public void run() {
          try {
            IOUtils.copy(nis, sout, 80);
//log.debug("chk11");
            exitVal[0] = 0;
          } catch (Exception ex) {
            exitVal[0] = 1;
          }
        }
      };
//log.debug("chk3");
      treader.start();
//log.debug("chk4");

      sin.setAsyncMode(true);
      byte[] buf = new byte[80];
      int bc = sin.read(buf);

      while (bc != -1 && exitVal[0] == -1) {
        nout.write(buf, 0, bc);
        bc = sin.read(buf);
      }

//log.debug("chk5");
      proc.waitFor();
//log.debug("chk6");
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.