예제 #1
0
  /**
   * Method responsible for receiving messages from the Server, reading information from the
   * DataInputStream.
   *
   * @param in The DataInputStream where we are going to read the information about the idea.
   * @return A boolean value, indicating the success or failure of the operation.
   */
  public boolean readFromDataStream(DataInputStream in) {

    if ((this.id = Common.recvInt(in)) == -1) return false;
    if ((this.uid = Common.recvInt(in)) == -1) return false;
    if ((this.title = Common.recvString(in)) == null) return false;
    if ((this.body = Common.recvString(in)) == null) return false;
    if ((this.file = Common.recvString(in)) == null) return false;
    if ((this.shares_to_buy = Common.recvInt(in)) == -1) return false;
    if ((this.numSharesOwned = Common.recvInt(in)) == -1) return false;
    if ((this.percentOwned = Common.recvFloat(in)) == -1) return false;

    int tmp;
    if ((tmp = Common.recvInt(in)) == -1) return false;
    this.inWatchList = tmp == 1;

    if ((this.sellingPrice = Common.recvFloat(in)) == -1) return false;
    if ((this.marketValue = Common.recvFloat(in)) == -1) return false;
    if ((this.facebookId = Common.recvInt(in)) == -1) return false;

    return true;
  }