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

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

?? bytedata.java

?? Short Message Peer to Peer
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
	 * @param string the string to check
	 
	 * @param min    the minimal length of the string with added term. zero
	 * @param max    the maximal length of the string with added term. zero
	 * @throws WrongLengthOfStringException thrown if string with added
	 *         terminating zero would be shorter than minimum or longer than
	 *         the maximum
	 */
	protected static void checkCString(String string, int min, int max) throws WrongLengthOfStringException {
		int count = string == null ? 1 : (string.length() + 1); // 1 is for terminating zero
		if (count < min || count > max) {
			throw new WrongLengthOfStringException(min, max, count);
		}
	}

	/**
	 * Checks if the string contains valid date string as specified in SMPP spec.
	 *
	 * @param dateStr the date to check
	 * @throws WrongDateFormatException throwsn if the string doesn't
	 *         contain date with valid format
	 */
	protected static void checkDate(String dateStr) throws WrongDateFormatException {
		int count = dateStr == null ? 1 : (dateStr.length() + 1); // 1 is for terminating zero
		if ((count != 1) && (count != Data.SM_DATE_LEN)) {
			throw new WrongDateFormatException(dateStr);
		}
		if ((count == 1) || (!libraryCheckDateFormat)) {
			// i.e. no date provided or don't check the format
			return;
		}
		char locTime = dateStr.charAt(dateStr.length() - 1);
		if ("+-R".lastIndexOf(locTime) == -1) {
			// i.e. the locTime isn't one of the possible values
			throw new WrongDateFormatException(
				dateStr,
				"time difference relation indicator incorrect; " + "should be +, - or R and is " + locTime);
		}
		int formatLen = SMPP_TIME_DATE_FORMAT.length();
		String dateJavaStr = dateStr.substring(0, formatLen);
		synchronized (dateFormatter) {
			try {
				if (locTime == 'R') {
					// check relative date
					// won't check date validity just if it's all number it
					Long.parseLong(dateJavaStr);
				} else {
					// check absolute dates
					dateFormatter.parse(dateJavaStr);
				}
			} catch (ParseException e) {
				debug.write("Exception parsing absolute date " + dateStr + " " + e);
				throw new WrongDateFormatException(dateStr, "format of absolute date-time incorrect");
			} catch (NumberFormatException e) {
				debug.write("Exception parsing relative date " + dateStr + " " + e);
				throw new WrongDateFormatException(dateStr, "format of relative date-time incorrect");
			}
		}
		String tenthsOfSecStr = dateStr.substring(formatLen, formatLen + 1);
		try {
			Integer.parseInt(tenthsOfSecStr);
		} catch (NumberFormatException e) {
			throw new WrongDateFormatException(dateStr, "non-numeric tenths of seconds " + tenthsOfSecStr);
		}
		String timeDiffStr = dateStr.substring(formatLen + 1, formatLen + 3);
		int timeDiff = 0;
		try {
			timeDiff = Integer.parseInt(timeDiffStr);
		} catch (NumberFormatException e) {
			throw new WrongDateFormatException(dateStr, "non-numeric time difference " + timeDiffStr);
		}
		if ((timeDiff < 0) || (timeDiff > 48)) {
			// defined in SMPP v3.4 sect. 7.1.1
			throw new WrongDateFormatException(
				dateStr,
				"time difference is incorrect; " + "should be between 00-48 and is " + timeDiffStr);
		}
	}

	/**
	 * Checks if the integer value is within provided valid range of values.
	 *
	 * @param min minimal possible value
	 * @param val the value to check
	 * @param max maximal possible value
	 * @throws IntegerOutOfRangeException thrown if the value is out of bounds
	 */
	protected static void checkRange(int min, int val, int max) throws IntegerOutOfRangeException {
		if ((val < min) || (val > max)) {
			throw new IntegerOutOfRangeException(min, max, val);
		}
	}

	/**
	 * Allow a variable of type <code>byte</code> to carry lengths or sizes up to 255.
	 * The integral types are signed in Java, so if there is necessary to store
	 * an unsigned type into signed of the same size, the value can be stored
	 * as negative number even if it would be positive in unsigned case.
	 * For example message length can be 0 to 254 and is carried by 1 octet
	 * i.e. unsigned 8 bits. We use a byte variable to read the value from octet stream.
	 * If the length is >127, it is interpreted as negative byte using negative
	 * complement notation.
	 * So length 150 would be interpreted as Java byte -106. If we want to know
	 * the actual value (*length) we need to make a correction to a bigger integral type,
	 * in case of byte it's short. The correction from (negative) byte to short is<br>
	 * <code>(short)(256+(short)length)</code><br>
	 * This converts the negative byte value representing positive length into positive
	 * short value.
	 * @see #encodeUnsigned(short)
	 */
	protected static short decodeUnsigned(byte signed) {
		if (signed >= 0) {
			return signed;
		} else {
			return (short) (256 + (short) signed);
		}
	}

	/**
	 * Provides correction of positive unsigned 2 byte carried 
	 * by (signed) <code>short</code> into positive signed <code>int</code>.
	 * See explanation in <code>decodeUnsigned(byte)</code>.
	 * @see #decodeUnsigned(byte)
	 * @see #encodeUnsigned(int)
	 */
	protected static int decodeUnsigned(short signed) {
		if (signed >= 0) {
			return signed;
		} else {
			return (int) (65536 + (int) signed);
		}
	}

	/**
	 * Complementary operation to <code>decodeUnsigned</code>.
	 * @see #decodeUnsigned(byte)
	 */
	protected static byte encodeUnsigned(short positive) {
		if (positive < 128) {
			return (byte) positive;
		} else {
			return (byte) (- (256 - positive));
		}
	}

	/**
	 * Complementary operation to <code>decodeUnsigned</code>.
	 * @see #decodeUnsigned(byte)
	 * @see #decodeUnsigned(short)
	 */
	protected static short encodeUnsigned(int positive) {
		if (positive < 32768) {
            // paolo@bulksms.com 2005-09-22: no, this isn't right! Casting the
			// short to a byte here overflows the byte, converts it back to a
			// short, and produces a bogus result. This was the cause of a bug
			// whereby invalid TLVs were produced: try creating a TLV longer than
			// 127 octets and see what happens...
			//return (byte)positive;
			return (short)positive;
		} else {
			return (short) (- (65536 - positive));
		}
	}

	/**
	 * Returns human readable version of the data carried by the object.
	 * Derived classes should override this method with possible inclusion
	 * of result of <code>super.debugString()</code>.
	 *
	 * @return the textual form of the content of the object
	 */
	public String debugString() {
		return new String("");
	}

}
/*
 * $Log: ByteData.java,v $
 * Revision 1.3  2006/03/09 16:24:14  sverkera
 * Removed compiler and javadoc warnings
 *
 * Revision 1.2  2005/09/25 09:33:45  paoloc
 * Fixed bug in encodeUnsigned(int): if one created a TLV longer than 127 octets, the resul was invalid (invalid L)
 *
 * Revision 1.1  2003/07/23 00:28:39  sverkera
 * Imported
 *
 *
 * Old changelog:
 * 13-07-01 ticp@logica.com indentation fixed, tabs aren't used anymore
 * 03-10-01 ticp@logica.com string passed as a parameter to the string length
 *						    checking routines is now checked first if it's not null
 * 03-10-01 ticp@logica.com the datetime string format is fully checked
 *						    in the function checkDate according to the date format
 *						    spec in smpp
 * 31-10-01 ticp@logica.com added methods for correction from 'smaller' int negative
 *						    to 'bigger' int positive (for variables carrying lengths)
 *						    (several times reported this, thanks!)
 * 15-11-01 ticp@logica.com added support for checking length of data produced
 *						    from string with multibyte encoding
 * 16-11-01 ticp@logica.com added method for checking if length provided as int
 *						    is within provided bounds
 * 20-11-01 ticp@logica.com fixed date checking where relative dates were
 *						    rejected as incorrect; now relative dates are checked
 *						    only partially
 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品免费一二三区| 日韩一级片在线观看| 欧洲人成人精品| 欧美大黄免费观看| 亚洲情趣在线观看| 久久er精品视频| 色婷婷综合久久久久中文| 精品国产百合女同互慰| 亚洲日穴在线视频| 国产经典欧美精品| 精品三级av在线| 亚洲成a人在线观看| 99精品久久久久久| 欧美精品一区二区三| 午夜成人免费电影| 色综合一个色综合亚洲| 国产精品女同一区二区三区| 久久成人18免费观看| 欧美日韩国产一区二区三区地区| 中文字幕国产一区二区| 国内国产精品久久| 日韩亚洲欧美成人一区| 五月婷婷久久综合| 欧日韩精品视频| 亚洲精品乱码久久久久久黑人 | 日本免费新一区视频| 色婷婷综合久久久中文一区二区| 国产精品家庭影院| 成人激情小说网站| 国产精品久久久久精k8| 成人黄色大片在线观看| 亚洲国产精品成人久久综合一区| 国内精品嫩模私拍在线| 久久久久久免费毛片精品| 国内精品伊人久久久久av影院| 精品国产精品一区二区夜夜嗨| 日本va欧美va精品发布| 日韩欧美国产电影| 黄色小说综合网站| 久久网这里都是精品| 国产成人精品免费在线| 欧美韩日一区二区三区四区| 丰满少妇在线播放bd日韩电影| 中文字幕欧美日韩一区| 东方欧美亚洲色图在线| 成人免费视频在线观看| 在线视频一区二区三| 亚洲va欧美va人人爽午夜| 91精品国产免费| 狠狠色2019综合网| 日本一区二区在线不卡| 97精品久久久久中文字幕| 亚洲成人av一区| 精品福利一区二区三区| 风流少妇一区二区| 亚洲一级二级三级在线免费观看| 欧美久久久久久久久中文字幕| 青青草国产成人99久久| 国产三级三级三级精品8ⅰ区| 97久久超碰国产精品| 午夜精品免费在线观看| 欧美午夜视频网站| 紧缚奴在线一区二区三区| 日韩欧美国产麻豆| jlzzjlzz欧美大全| 精品日韩在线观看| 99riav久久精品riav| 亚洲777理论| 欧美zozozo| 99精品欧美一区二区三区小说| 亚洲二区在线观看| 久久久久久久久99精品| 91激情五月电影| 韩国精品主播一区二区在线观看| 最新热久久免费视频| 日韩限制级电影在线观看| 久久精品国产精品亚洲精品| 亚洲欧洲精品天堂一级| 日韩欧美中文字幕精品| 成人午夜在线视频| 亚洲va中文字幕| 自拍av一区二区三区| 欧美一二区视频| 色悠悠亚洲一区二区| 韩国女主播成人在线| 亚洲va国产天堂va久久en| xf在线a精品一区二区视频网站| 91在线视频免费观看| 久久99热国产| 亚洲成av人片在www色猫咪| 国产精品成人午夜| 26uuu国产日韩综合| 欧美一级一区二区| 在线视频中文字幕一区二区| av电影在线观看完整版一区二区| 美女一区二区久久| 亚洲成人精品影院| 亚洲精品成人天堂一二三| 国产日本欧洲亚洲| 精品国产网站在线观看| 3d动漫精品啪啪| 色噜噜狠狠成人中文综合 | 色哟哟国产精品| 国产一区二区三区免费播放| 日韩电影一二三区| 亚洲国产精品久久人人爱蜜臀 | 久久久久久久久蜜桃| 日韩午夜在线观看| 欧美精品三级日韩久久| 日本韩国精品一区二区在线观看| 成人18视频在线播放| 国产白丝精品91爽爽久久| 紧缚奴在线一区二区三区| 美国十次综合导航| 国产在线一区二区| 国产一区二区三区香蕉| 国内一区二区视频| 国产精品99久| 国产99精品国产| 成人激情电影免费在线观看| 懂色av中文字幕一区二区三区 | 蜜臀a∨国产成人精品| 日韩高清不卡一区二区三区| 午夜精品影院在线观看| 日本在线不卡一区| 免费观看在线综合色| 免费人成网站在线观看欧美高清| 麻豆精品精品国产自在97香蕉| 天天综合网 天天综合色| 亚洲小少妇裸体bbw| 日韩电影在线观看电影| 精品一区二区三区久久| 极品少妇xxxx精品少妇| 蜜臀av性久久久久蜜臀aⅴ | 555夜色666亚洲国产免| 欧美一区二区三区四区视频| 精品国产乱码久久久久久久| 欧美韩日一区二区三区四区| 一区二区激情视频| 日韩电影免费在线| 国产传媒一区在线| 91美女精品福利| 欧美精品在线观看播放| 久久先锋影音av| 伊人色综合久久天天| 日韩av网站在线观看| 国产精品456| 色噜噜狠狠一区二区三区果冻| 欧美日韩免费观看一区二区三区| 欧美成人国产一区二区| 一区精品在线播放| 奇米影视一区二区三区小说| 国产999精品久久久久久绿帽| 欧美三级午夜理伦三级中视频| 久久蜜桃香蕉精品一区二区三区| 中文字幕免费一区| 午夜精品免费在线观看| 国产suv精品一区二区6| 欧美日韩国产在线播放网站| 久久久久久久一区| 天天综合色天天综合色h| 风间由美一区二区av101| 欧美日韩在线播放一区| 久久奇米777| 首页欧美精品中文字幕| 波多野结衣欧美| 欧美乱妇23p| 中文字幕第一区综合| 五月天一区二区三区| 成人app在线| 久久亚洲综合色一区二区三区| 自拍偷拍国产精品| 亚洲va国产va欧美va观看| 国产一区二区在线影院| 91精品国产综合久久久久久久久久| 国产精品久久久久一区二区三区 | 国产一区二区三区久久悠悠色av| 91在线精品一区二区| 精品99一区二区三区| 一区二区三区日韩欧美精品 | 91看片淫黄大片一级| 久久精品国产免费| 亚洲第一搞黄网站| 热久久国产精品| 91搞黄在线观看| 日韩伦理免费电影| 国产盗摄女厕一区二区三区| 7777精品伊人久久久大香线蕉最新版| 国产精品美女久久久久久 | 亚洲精品菠萝久久久久久久| 国产成人免费在线视频| 2023国产精品| 毛片av中文字幕一区二区| 欧美久久久久中文字幕| 亚洲aaa精品| 欧美一区二区三区播放老司机| 午夜婷婷国产麻豆精品| 欧美午夜精品理论片a级按摩| 亚洲美女一区二区三区| 色先锋aa成人|