亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cmessage.java

?? Sending and receiving of SMS using Java
?? JAVA
字號:
// SMSLib for Java
// An open-source API Library for sending and receiving SMS via a GSM modem.
// Copyright (C) 2002-2007, Thanasis Delenikas, Athens/GREECE
// Web Site: http://www.smslib.org
//
// SMSLib is distributed under the LGPL license.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

package org.smslib;

import java.util.*;

/**
 * This is the parent class defining a generic SMS message. In almost all cases, you will not work with this class, except for calling some methods for accessing info fields common for all types of messages.
 * 
 * @see CIncomingMessage
 * @see COutgoingMessage
 * @see CStatusReportMessage
 * @see CWapSIMessage
 */
public class CMessage implements java.io.Serializable
{
	private static final long serialVersionUID = 1L;

	/**
	 * Holds values representing message encodings.
	 */
	public static class MessageEncoding
	{
		/**
		 * 7-Bit (default GSM alphabet) encoding.
		 */
		public static final int Enc7Bit = 1;

		/**
		 * 8-Bit encoding.
		 */
		public static final int Enc8Bit = 2;

		/**
		 * UCS2 (Unicode) encoding. Use this for Far-East languages.
		 */
		public static final int EncUcs2 = 3;
		
		/**
		 * Custom encoding. When you set this value, you should also set the DCS (Data Coding Scheme) value yourself!
		 */
		public static final int EncCustom = 4;
	}

	/**
	 * Holds values representing message types.
	 */
	public static class MessageType
	{
		/**
		 * Incoming (inbound) message.
		 */
		public static final int Incoming = 1;

		/**
		 * Outgoing (outbound) message.
		 */
		public static final int Outgoing = 2;

		/**
		 * Delivery status report message.
		 */
		public static final int StatusReport = 3;

		/**
		 * WAP PUSH-SI message.
		 */
		public static final int WapPushSI = 4;
	}

	protected int type;

	protected int refNo;

	protected String id;

	protected Date date;

	protected String originator;

	protected String recipient;

	protected String text;
	
	protected String encodedText;

	protected int messageEncoding;

	protected int pid;

	protected int dcs;


	public CMessage(int type, Date date, String originator, String recipient, String text)
	{
		this.type = type;
		this.refNo = -1;
		this.id = null;
		setDate(date);
		this.originator = originator;
		this.recipient = recipient;
		this.text = text;
		this.messageEncoding = MessageEncoding.Enc7Bit;
	}

	/**
	 * Returns the message type.
	 * 
	 * @return The message type.
	 * @see MessageType
	 */
	public int getType()
	{
		return type;
	}

	/**
	 * Returns the message SMSC Reference Number.
	 * 
	 * @return The SMSC Ref Number.
	 */
	public int getRefNo()
	{
		return refNo;
	}

	/**
	 * Returns the message id.
	 * 
	 * @return The message id.
	 * @see #setId(String)
	 */
	public String getId()
	{
		return id;
	}

	/**
	 * Returns the message date.
	 * 
	 * @return The message date.
	 */
	public Date getDate()
	{
		return date == null ? null : (Date) date.clone();
	}

	/**
	 * Returns the message text.
	 * 
	 * @return The message text.
	 */
	public String getText()
	{
		return text;
	}

	/**
	 * Returns the message encoding.
	 * 
	 * @return The message encoding.
	 * @see MessageEncoding
	 */
	public int getMessageEncoding()
	{
		return messageEncoding;
	}

	/**
	 * Sets the id of the message.
	 * <p>
	 * The message id is a user-defined id field. It is not used in actual sending or receiving of a message. So, even if you don't define it, SMSLib will work normally. Use it if you need to differentiate messages in some way.
	 * 
	 * @param id
	 *            The message id.
	 * @see #getId()
	 */
	public void setId(String id)
	{
		this.id = id;
	}

	/**
	 * Sets the message text.
	 * 
	 * @param text
	 *            The message text.
	 */
	public void setText(String text)
	{
		this.text = text;
	}

	/**
	 * Sets the message (create) date.
	 * 
	 * @param date
	 *            The message date.
	 */
	public void setDate(Date date)
	{
		this.date = (date != null ? (Date) date.clone() : new java.util.Date());
	}

	/**
	 * Sets the message encoding.
	 * 
	 * @param messageEncoding
	 *            The message encoding.
	 * @see MessageEncoding
	 */
	public void setMessageEncoding(int messageEncoding)
	{
		this.messageEncoding = messageEncoding;
		if (text == null) return;
		encodedText = "";
		switch (this.messageEncoding)
		{
			case MessageEncoding.Enc7Bit:
				encodedText = CGSMAlphabet.textToPDU(text);
				if (encodedText.charAt(encodedText.length() - 1) == '0' && encodedText.charAt(encodedText.length() - 2) == '0')
				{
					text += " ";
					setMessageEncoding(messageEncoding);
				}
				break;
			case MessageEncoding.Enc8Bit:
				for (int i = 0; i < text.length(); i++)
				{
					char c = text.charAt(i);;
					encodedText += ((Integer.toHexString(c).length() < 2) ? "0" + Integer.toHexString(c) : Integer.toHexString(c));
				}
				break;
			case MessageEncoding.EncUcs2:
				for (int i = 0; i < text.length(); i++)
				{
					char c = text.charAt(i);
					int high = (int)(c / 256);
					int low = c % 256;
					encodedText += ((Integer.toHexString(high).length() < 2) ? "0" + Integer.toHexString(high) : Integer.toHexString(high));
					encodedText += ((Integer.toHexString(low).length() < 2) ? "0" + Integer.toHexString(low) : Integer.toHexString(low));
				}
				break;
			case MessageEncoding.EncCustom:
				if ((dcs & 0x04) == 0)
				{
					encodedText = CGSMAlphabet.textToPDU(text);
					if (encodedText.charAt(encodedText.length() - 1) == '0' && encodedText.charAt(encodedText.length() - 2) == '0')
					{
						text += " ";
						setMessageEncoding(messageEncoding);
					}
				}
				else
				{
					for (int i = 0; i < text.length(); i++)
					{
						char c = text.charAt(i);;
						encodedText += ((Integer.toHexString(c).length() < 2) ? "0" + Integer.toHexString(c) : Integer.toHexString(c));
					}
				}
				break;
		}
	}

	protected void setRefNo(int refNo)
	{
		this.refNo = refNo;
	}

	protected void addText(String text)
	{
		this.text += text;
	}

	/**
	 * Sets the message Protocol Id. Normally, you should not care about this value - by default it is set to 0 which is appropriate for normal SMS messages.
	 * 
	 * @param pid
	 *            The Protocol Id.
	 *            
	 *  @see #getPid()
	 */
	public void setPid(int pid)
	{
		this.pid = pid;
	}

	/**
	 * Returns the message's Protocol id.
	 * 
	 * @return The Protocol id.
	 * 
	 * @see #setPid(int)
	 */
	public int getPid()
	{
		return pid;
	}

	/**
	 * Sets the message's DCS (Data Coding Scheme). SMSLib will use this value if you set the message encoding to EncCustom.
	 * 
	 * @param dcs
	 *            The DCS value.
	 * @see #setMessageEncoding(int)
	 * @see #getDcs()
	 */
	public void setDcs(int dcs)
	{
		this.dcs = dcs;
	}

	/**
	 * Returns the message's DCS (Data Coding Scheme).
	 * 
	 * @return The DCS value.
	 * 
	 * @see #setDcs(int)
	 */
	public int getDcs()
	{
		return dcs;
	}

	/**
	 * A message-to-string mapping function. Used for debugging and for easy viewing of of message object's info fields.
	 */
	public String toString()
	{
		String str = "";

		str += "===============================================================================";
		str += "\n";
		str += "<< MESSAGE DUMP >>";
		str += "\n";
		str += "-------------------------------------------------------------------------------";
		str += "\n";
		str += " Type: " + (type == MessageType.Incoming ? "Incoming" : (type == MessageType.Outgoing ? "Outgoing" : "Status Report"));
		str += "\n";
		str += " Encoding: " + (messageEncoding == MessageEncoding.Enc7Bit ? "7-bit" : (messageEncoding == MessageEncoding.Enc8Bit ? "8-bit" : "UCS2 (Unicode)"));
		str += "\n";
		str += " Date: " + date;
		str += "\n";
		str += " Originator: " + originator;
		str += "\n";
		str += " Recipient: " + recipient;
		str += "\n";
		str += " Text: " + text;
		str += "\n";
		str += " SMSC Ref No: " + refNo;
		str += "\n";
		if (type == MessageType.Incoming)
		{
			CIncomingMessage msg = (CIncomingMessage) this;
			str += " Memory Index: " + msg.getMemIndex();
			str += "\n";
			str += " Multi-part Memory Index: " + msg.getMpMemIndex();
			str += "\n";
			str += " Memory Location: " + msg.getMemLocation();
			str += "\n";
		}
		if (type == MessageType.Outgoing)
		{
			COutgoingMessage msg = (COutgoingMessage) this;
			str += " Dispatch Date: " + msg.getDispatchDate();
			str += "\n";
			str += " Validity Period (Hours): " + msg.getValidityPeriod();
			str += "\n";
			str += " Status Report: " + msg.getStatusReport();
			str += "\n";
			str += " Source / Destination Ports: " + msg.getSourcePort() + " / " + msg.getDestinationPort();
			str += "\n";
			str += " Flash SMS: " + msg.getFlashSms();
			str += "\n";
		}
		if (type == MessageType.StatusReport)
		{
			CStatusReportMessage msg = (CStatusReportMessage) this;
			str += " Date Sent: " + msg.getDateOriginal();
			str += "\n";
			str += " Date Received (by recipient): " + msg.getDateReceived();
			str += "\n";
			str += " Delivery Status: ";
			if (msg.getDeliveryStatus() == CStatusReportMessage.DeliveryStatus.Delivered) str += "Delivered";
			else if (msg.getDeliveryStatus() == CStatusReportMessage.DeliveryStatus.KeepTrying) str += "Not delivered yet - will keep trying.";
			else if (msg.getDeliveryStatus() == CStatusReportMessage.DeliveryStatus.Aborted) str += "Not delivered - aborted.";
			str += "\n";
		}

		str += "===============================================================================";
		str += "\n";
		return str;
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久亚洲综合影院红桃| 亚洲国产欧美在线人成| 成人三级伦理片| 成人av资源在线| 欧美人体做爰大胆视频| 久久品道一品道久久精品| 一区二区三区国产豹纹内裤在线| 亚洲.国产.中文慕字在线| 国产一区二区日韩精品| 色香蕉成人二区免费| 欧美不卡一二三| 亚洲国产日韩一区二区| 99精品久久久久久| 久久精品一区八戒影视| 日本不卡的三区四区五区| 99re6这里只有精品视频在线观看| 日韩免费视频一区| 亚洲一级二级三级在线免费观看| 成人免费视频一区| 国产日本欧洲亚洲| 国产精品一区二区久激情瑜伽| 欧美丰满高潮xxxx喷水动漫| 亚洲人精品一区| 成人不卡免费av| 欧美国产日产图区| 成人妖精视频yjsp地址| 久久一夜天堂av一区二区三区| 男女视频一区二区| 欧美人体做爰大胆视频| 日韩精品午夜视频| 欧美日韩小视频| 亚洲一区在线免费观看| 欧美午夜一区二区三区| 一区二区成人在线| 在线播放欧美女士性生活| 日韩精彩视频在线观看| 91精品综合久久久久久| 毛片av中文字幕一区二区| 精品美女在线播放| 国产精品996| 中文字幕国产精品一区二区| 成人综合婷婷国产精品久久免费| 国产精品视频一二| 色婷婷综合在线| 婷婷夜色潮精品综合在线| 欧美一区二区三区人| 激情久久久久久久久久久久久久久久| 日韩欧美国产高清| 国产成人午夜视频| 亚洲图片另类小说| 色悠悠久久综合| 色综合天天视频在线观看| 亚洲色图欧洲色图| 日本高清免费不卡视频| 一区二区三区四区激情| 欧美亚洲综合另类| 日韩高清在线不卡| 日韩精品一区二区三区中文精品| 婷婷综合五月天| 欧美三级电影在线看| 丝袜美腿亚洲色图| 欧美α欧美αv大片| 国内外精品视频| 国产精品久久精品日日| 色婷婷精品大在线视频| 午夜激情久久久| 精品999在线播放| 福利一区福利二区| 亚洲一区二区高清| 欧美成人vps| 99国产精品国产精品毛片| 亚洲天堂a在线| 91精品啪在线观看国产60岁| 久久99日本精品| 国产日韩欧美高清在线| 99久久久久久| 日韩影院精彩在线| 国产片一区二区| 制服丝袜av成人在线看| 国产福利一区二区三区视频 | 亚洲狠狠爱一区二区三区| 4438成人网| 粉嫩久久99精品久久久久久夜| 亚洲日本在线a| 欧美高清视频www夜色资源网| 美女视频黄免费的久久 | 欧美精品日韩精品| 成人久久视频在线观看| 亚洲成年人影院| 久久久久国色av免费看影院| 色猫猫国产区一区二在线视频| 视频在线观看国产精品| 中文字幕欧美三区| 一本大道久久精品懂色aⅴ| 丝袜亚洲另类丝袜在线| 国产欧美一区二区三区鸳鸯浴 | 日韩免费高清电影| 色综合久久久久综合体桃花网| 蜜桃av一区二区三区电影| 日韩欧美一级二级三级久久久| 国产伦精品一区二区三区视频青涩| 亚洲精品国产一区二区精华液 | 国产精品久久久久四虎| 欧美喷潮久久久xxxxx| 福利一区福利二区| 麻豆传媒一区二区三区| 国产精品水嫩水嫩| 久久一区二区视频| 色综合久久久久综合体| 91蝌蚪porny成人天涯| 久久99久久久久久久久久久| 亚洲欧洲韩国日本视频| 欧美国产精品一区二区三区| 9191久久久久久久久久久| 一本大道av伊人久久综合| 成人激情免费电影网址| 久草在线在线精品观看| 男女激情视频一区| 亚洲高清免费一级二级三级| 国产欧美精品区一区二区三区| 91麻豆精品国产91久久久久久| 一本久道久久综合中文字幕| 国产成人在线观看免费网站| 日本午夜精品视频在线观看| 视频在线观看一区二区三区| 亚洲va天堂va国产va久| 中文字幕一区二区三区视频| 欧美变态口味重另类| 精品国内二区三区| 欧美本精品男人aⅴ天堂| 日韩欧美一区二区不卡| 91老师国产黑色丝袜在线| 在线精品观看国产| 一本色道久久综合精品竹菊| 一本久久精品一区二区| 在线视频中文字幕一区二区| 成人自拍视频在线观看| 高清日韩电视剧大全免费| 成人国产精品免费| 91蜜桃在线免费视频| 91福利在线播放| 欧美日韩国产一级| 欧美一区二区三区公司| 精品久久国产老人久久综合| 国产亚洲综合av| 欧美国产精品v| 亚洲综合自拍偷拍| 婷婷丁香久久五月婷婷| 亚洲制服丝袜av| 日本色综合中文字幕| 精品一区二区三区在线视频| 国产精品影音先锋| 99国内精品久久| 91精品欧美一区二区三区综合在| 日韩亚洲欧美一区| 国产欧美日韩一区二区三区在线观看| 久久久国产精品不卡| 一区二区三区四区蜜桃| 久久精品久久综合| 不卡av免费在线观看| 在线亚洲欧美专区二区| 精品久久久久久久久久久院品网 | 欧美性受极品xxxx喷水| 8x8x8国产精品| 国产亚洲精品精华液| 国产精品精品国产色婷婷| 亚洲一区在线电影| 精品亚洲成a人| 91老司机福利 在线| 久久奇米777| 日韩精品高清不卡| 成人丝袜18视频在线观看| 欧美久久高跟鞋激| 国产精品国产三级国产aⅴ中文 | 国内精品免费**视频| 91网址在线看| 精品成人免费观看| 一区二区在线观看视频| 韩国中文字幕2020精品| 欧美亚洲禁片免费| 国产精品免费视频一区| 免费亚洲电影在线| 在线精品视频免费播放| 久久久久久毛片| 亚洲成a人v欧美综合天堂| 国产91丝袜在线播放0| 欧美日韩免费观看一区二区三区| 亚洲欧洲国产专区| 国产一区二区三区四区五区入口 | 色婷婷综合中文久久一本| 久久综合狠狠综合久久激情| 亚洲午夜久久久久中文字幕久| 国产91露脸合集magnet| 精品少妇一区二区三区在线播放| 欧美极品美女视频| 激情综合网最新| 日韩一区二区在线看片| 亚洲国产一区视频| 91色在线porny| 国产精品无码永久免费888|