// Essentially links an InputStream to the proper channels in the log box.
 private static void printOutput(InputStream in, SimpleAttributeSet set) {
   int i = 0;
   String s = "";
   try {
     while ((i = in.read()) != -1) {
       s += (char) i;
       // print(, set);
     }
   } catch (IOException io) {
     println("Error: IOException when reading InputStream " + in.toString(), progErr);
   }
   println(s);
 }
  Ps2RealityControlCenter(String dir) throws IOException {

    try {
      byte[] abIcon;
      InputStream inputstreamIcon = this.getClass().getResourceAsStream("icon.gif");
      int iIconSize = inputstreamIcon.available();
      abIcon = new byte[iIconSize];
      inputstreamIcon.read(abIcon);
      this.setIconImage(new ImageIcon(abIcon).getImage());

    } catch (Exception ex) {
      // the default icon will be used
    }
    panelChooser = new Ps2RealityFileChooser(dir);
  }
示例#3
0
    public void run() {
      try {
        final byte[] lBuf = new byte[1024];
        int lBytesRead;

        while (in.read(lBuf, 0, 1) != -1) {
          synchronized (JConsole.this) {
            lBytesRead = in.read(lBuf, 1, 1023) + 1;
            print(new String(lBuf, 0, lBytesRead), attr);

            while (in.available() > 0) {
              lBytesRead = in.read(lBuf);
              print(new String(lBuf, 0, lBytesRead), attr);
            }
          }
        }
      } catch (IOException e) {
        e.printStackTrace();
      }
    }