⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outboundmessage.java

📁 java发短信用的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	 *            The recipient of the message.
	 * @see #getRecipient()
	 */
	protected void setRecipient(String recipient)
	{
		this.recipient = recipient;
	}

	/**
	 * Returns the dispatch date of this message. If the message has not been
	 * sent yet, the dispatch date is null.
	 * 
	 * @return The message dispatch date.
	 */
	public Date getDispatchDate()
	{
		if (dispatchDate != null) return new java.util.Date(dispatchDate.getTime());
		else return null;
	}

	void setDispatchDate(Date dispatchDate)
	{
		this.dispatchDate = dispatchDate;
	}

	/**
	 * Returns the destination port of the message. Source and Destination ports
	 * are used when messages are targeting a midlet application. For standard
	 * SMS messages, the Source and Destination ports should <b>both</b> be set
	 * to -1 (which is their default value anyway).
	 * 
	 * @return The destination port.
	 * @see #getDstPort()
	 * @see #setSrcPort(int)
	 * @see #getSrcPort()
	 */
	public int getDstPort()
	{
		return dstPort;
	}

	/**
	 * Sets the destination port of the message. Source and Destination ports
	 * are used when messages are targeting a midlet application. For standard
	 * SMS messages, the Source and Destination ports should <b>both</b> be set
	 * to -1 (which is their default value anyway).
	 * <p>
	 * The default is (-1).
	 * 
	 * @param dstPort
	 *            The destination port.
	 * @see #setDstPort(int)
	 * @see #setSrcPort(int)
	 * @see #getSrcPort()
	 */
	public void setDstPort(int dstPort)
	{
		this.dstPort = dstPort;
	}

	/**
	 * Returns true if this message is to be sent out as a flash SMS. Otherwise,
	 * it returns false.
	 * 
	 * @return True for a Flash message.
	 * @see #setFlashSms(boolean)
	 */
	public boolean getFlashSms()
	{
		return flashSms;
	}

	/**
	 * Set the flash message indication. Set this to true for this message to be
	 * sent as a flash message. Flash messages appear directly on the handset,
	 * so use this feature with care, because it may be a bit annoying.
	 * Furthermore, keep in mind that flash messaging is not supported on all
	 * phones.
	 * <p>
	 * The default is non-flash (false).
	 * 
	 * @param flashSms
	 *            True for a flash sms.
	 */
	public void setFlashSms(boolean flashSms)
	{
		this.flashSms = flashSms;
	}

	/**
	 * Returns the source port of the message. Source and Destination ports are
	 * used when messages are targeting a midlet application. For standard SMS
	 * messages, the Source and Destination ports should <b>both</b> be set to
	 * -1 (which is their default value anyway).
	 * 
	 * @return The source port.
	 * @see #setSrcPort(int)
	 * @see #setDstPort(int)
	 * @see #getDstPort()
	 */
	public int getSrcPort()
	{
		return srcPort;
	}

	/**
	 * Sets the source port of the message. Source and Destination ports are
	 * used when messages are targeting a midlet application. For standard SMS
	 * messages, the Source and Destination ports should <b>both</b> be set to
	 * -1 (which is their default value anyway).
	 * <p>
	 * The default is (-1).
	 * 
	 * @param srcPort
	 *            The source port.
	 * @see #setDstPort(int)
	 * @see #setSrcPort(int)
	 * @see #getSrcPort()
	 */
	public void setSrcPort(int srcPort)
	{
		this.srcPort = srcPort;
	}

	/**
	 * Returns true if a status/delivery report will be asked for this message.
	 * 
	 * @return True if a status report will be generated.
	 */
	public boolean getStatusReport()
	{
		return statusReport;
	}

	/**
	 * Sets the status report request. If you set it to true, a status report
	 * message will be generated, otherwise no status report message will be
	 * generated.
	 * <p>
	 * The default is (false).
	 * 
	 * @param statusReport
	 *            The status report request status.
	 */
	public void setStatusReport(boolean statusReport)
	{
		this.statusReport = statusReport;
	}

	/**
	 * Returns the message validity period (in hours).
	 * 
	 * @return The message validity period.
	 * @see #setValidityPeriod(int)
	 */
	public int getValidityPeriod()
	{
		return validityPeriod;
	}

	/**
	 * Sets the message validity period.
	 * 
	 * @param validityPeriod
	 *            The message validity period in hours.
	 * @see #getValidityPeriod()
	 */
	public void setValidityPeriod(int validityPeriod)
	{
		this.validityPeriod = validityPeriod;
	}

	/**
	 * Receives the custom originator string. Set it to empty string to leave
	 * the default behavior.
	 * 
	 * @return The custom originator string.
	 * @see #setFrom(String)
	 */
	public String getFrom()
	{
		return from;
	}

	/**
	 * Sets the custom originator string. Some gateways allow you to define a
	 * custom string as the originator. When the message arrives at the
	 * recipient, the latter will not see your number but this string.
	 * <p>
	 * Note that this functionality is not supported on GSM modems / phones. It
	 * is supported on most bulk sms operators.
	 * 
	 * @param from
	 *            The custom originator string.
	 * @see #getFrom()
	 */
	public void setFrom(String from)
	{
		this.from = from;
	}

	int getPid()
	{
		return pid;
	}

	void setPid(int pid)
	{
		this.pid = pid;
	}

	int getDcs()
	{
		return dcs;
	}

	void setDcs(int dcs)
	{
		this.dcs = dcs;
	}

	/**
	 * Returns the message status.
	 * 
	 * @return The message status.
	 * @see MessageStatuses
	 */
	public MessageStatuses getMessageStatus()
	{
		return messageStatus;
	}

	void setMessageStatus(MessageStatuses messageStatus)
	{
		this.messageStatus = messageStatus;
	}

	public FailureCauses getFailureCause()
	{
		return failureCause;
	}

	/**
	 * Mark message as failed and set cause of failure.
	 * 
	 * @param failureCause
	 *            Cause of failure
	 */
	void setFailureCause(FailureCauses failureCause)
	{
		if (failureCause != FailureCauses.NO_ERROR) this.messageStatus = MessageStatuses.FAILED;
		this.failureCause = failureCause;
	}

	/**
	 * Return value of internal sending retry counter.
	 * 
	 * @return Number of sending message retries
	 */
	public int getRetryCount()
	{
		return retryCount;
	}

	void incrementRetryCount()
	{
		retryCount++;
	}

	/**
	 * Returns the priority of the message.
	 * 
	 * @return The priority of the message.
	 * @see MessagePriorities
	 */
	public MessagePriorities getPriority()
	{
		return priority;
	}

	/**
	 * Sets the priority of the message.
	 * 
	 * @param priority
	 *            The new priority.
	 * @see MessagePriorities
	 */
	public void setPriority(MessagePriorities priority)
	{
		this.priority = priority;
	}

	/**
	 * Returns the message Reference Number. The Reference Number comes into
	 * existence when the message is sent. Its format depends on the gateway:
	 * For modems, its a number. For bulk sms operators, this is a hex string.
	 * If the message has not been sent yet, the Reference number is blank.
	 * 
	 * @return The message reference number.
	 */
	public String getRefNo()
	{
		return refNo;
	}

	void setRefNo(String refNo)
	{
		this.refNo = refNo;
	}

	public String toString()
	{
		String str = "";
		str += "===============================================================================";
		str += "\n";
		str += "<< OUTBOUND MESSAGE DUMP >>";
		str += "\n";
		str += "-------------------------------------------------------------------------------";
		str += "\n";
		str += " Gateway Id: " + getGatewayId();
		str += "\n";
		str += " Encoding: " + (getEncoding() == MessageEncodings.ENC7BIT ? "7-bit" : (getEncoding() == MessageEncodings.ENC8BIT ? "8-bit" : "UCS2 (Unicode)"));
		str += "\n";
		str += " Date: " + getDate();
		str += "\n";
		str += " Text: " + getText();
		str += "\n";
		str += " SMSC Ref No: " + refNo;
		str += "\n";
		str += " Recipient: " + recipient;
		str += "\n";
		str += " Dispatch Date: " + getDispatchDate();
		str += "\n";
		str += " Message Status: " + getMessageStatus();
		str += "\n";
		str += " Validity Period (Hours): " + getValidityPeriod();
		str += "\n";
		str += " Status Report: " + getStatusReport();
		str += "\n";
		str += " Source / Destination Ports: " + getSrcPort() + " / " + getDstPort();
		str += "\n";
		str += " Flash SMS: " + getFlashSms();
		str += "\n";
		str += "===============================================================================";
		str += "\n";
		return str;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -