Example #1
0
  /**
   * Returns the user data.
   *
   * @return user data
   */
  public SmsUserData getUserData() {
    SmsUserData ud;

    switch (dcs_.getAlphabet()) {
      case GSM:
        ud = new SmsUserData(SmsPduUtil.getSeptets(text_), text_.length(), dcs_);
        break;

      case LATIN1:
        ud = new SmsUserData(text_.getBytes(StandardCharsets.ISO_8859_1), text_.length(), dcs_);
        break;

      case UCS2:
        ud = new SmsUserData(text_.getBytes(StandardCharsets.UTF_16BE), text_.length() * 2, dcs_);
        break;

      default:
        ud = null;
        break;
    }

    return ud;
  }
Example #2
0
 /**
  * Creates an SmsTextMessage with the given alphabet and message class.
  *
  * @param msg The message
  * @param alphabet The alphabet
  * @param messageClass The messageclass
  */
 public SmsTextMessage(String msg, SmsAlphabet alphabet, SmsMsgClass messageClass) {
   this(msg, SmsDcs.getGeneralDataCodingDcs(alphabet, messageClass));
 }