コード例 #1
0
ファイル: Login.java プロジェクト: karlit0/Showcase
 public synchronized void send(String msg) {
   try {
     streamOut.writeUTF(msg);
   } catch (IOException ioe) {
     System.err.println("Sending error: " + ioe.getMessage());
     System.exit(0);
   }
 }
コード例 #2
0
ファイル: BT.java プロジェクト: rumanhassan/rdf-dbms
  /**
   * It gets the length of the key
   *
   * @param key specify the key whose length will be calculated. Input parameter.
   * @return return the length of the key
   * @exception KeyNotMatchException key is neither StringKey nor IntegerKey
   * @exception IOException error from the lower layer
   */
  protected static final int getKeyLength(KeyClass key) throws KeyNotMatchException, IOException {
    if (key instanceof StringKey) {

      OutputStream out = new ByteArrayOutputStream();
      DataOutputStream outstr = new DataOutputStream(out);
      outstr.writeUTF(((StringKey) key).getKey());
      return outstr.size();
    } else if (key instanceof IntegerKey) return 4;
    else throw new KeyNotMatchException(null, "key types do not match");
  }
コード例 #3
0
ファイル: Login.java プロジェクト: karlit0/Showcase
  private void SignInButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_SignInButtonActionPerformed

    /* username i password spojit u jedan string s delimiterom " ",
        prije toga nadodat kljucnu rijec "log"
        taj string se parsira na strani servera i server provjerava jel zadovoljava username i password
        (odgovor od servera slusa LoginThread koji salje odgovor Login-u preko handle metode)
    */
    String username = UsernameLogin.getText();
    String password = PasswordLogin.getText();
    String user_pass = "******" + " " + username + " " + password;

    try {
      streamOut.writeUTF(user_pass);
    } catch (IOException ioe) {
      System.err.println("Sending error: " + ioe.getMessage());
      System.exit(0);
    }
  } // GEN-LAST:event_SignInButtonActionPerformed