コード例 #1
0
ファイル: Connection.java プロジェクト: egphilippov/openwood
  /**
   * Creates a new connection to the specified host of specified type. <br>
   * <br>
   * type: Type of connection to create <br>
   * destination: Host to connect to (in "host:port" or "host" syntax)
   */
  public Connection(java.net.InetAddress host, int port, PluginContext ctx)
      throws MessagingNetworkException, java.io.IOException {
    if (TRAKTOR_USED) {
      if (traktorConnectionDown) throw new IOException("network is down");

      traktor = new Frame("" + host + ":" + port + " - Traktor");
      final Checkbox c = new Checkbox("break this & ALL future connections");
      c.setState(traktorConnectionDown);
      c.addItemListener(
          new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
              traktorConnectionDown = c.getState();
              try {
                if (traktorConnectionDown) closeSocket();
              } catch (Exception ex) {
              }
            }
          });
      traktor.add(c);
      traktor.setSize(100, 50);
      traktor.setLocation(230, 450);
      traktor.setVisible(true);
    } else {
      traktor = null;
    }
  }
コード例 #2
0
ファイル: Connection.java プロジェクト: egphilippov/openwood
 protected final java.io.OutputStream getOutputStream() throws IOException {
   if (isClosed()) {
     if (TRAKTOR_USED && traktor != null && !traktorConnectionDown) {
       traktor.dispose();
       traktor = null;
     }
     throw new IOException("connection closed");
   }
   OutputStream os = getOutputStream0();
   if (os == null) throw new IOException("connection closed");
   return os;
 }