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

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

?? stringutils.java

?? mysql jdbc驅動程序 mysql jdbc驅動程序 mysql jdbc驅動程序 mysql jdbc驅動程序
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/* Copyright (C) 2002-2004 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as  published by the Free Software Foundation. There are special exceptions to the terms and conditions of the GPL  as it is applied to this software. View the full text of the  exception in file EXCEPTIONS-CONNECTOR-J in the directory of this  software distribution. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package com.mysql.jdbc;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.StringReader;import java.io.UnsupportedEncodingException;import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;import java.math.BigDecimal;import java.sql.SQLException;import java.util.ArrayList;import java.util.List;import java.util.StringTokenizer;/** * Various utility methods for converting to/from byte arrays in the platform * encoding *  * @author Mark Matthews */public class StringUtils {		private static final int BYTE_RANGE = (1 + Byte.MAX_VALUE) - Byte.MIN_VALUE;	private static byte[] allBytes = new byte[BYTE_RANGE];	private static char[] byteToChars = new char[BYTE_RANGE];	private static Method toPlainStringMethod;	static final int WILD_COMPARE_MATCH_NO_WILD = 0;	static final int WILD_COMPARE_MATCH_WITH_WILD = 1;	static final int WILD_COMPARE_NO_MATCH = -1;	static {		for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {			allBytes[i - Byte.MIN_VALUE] = (byte) i;		}		String allBytesString = new String(allBytes, 0, Byte.MAX_VALUE				- Byte.MIN_VALUE);		int allBytesStringLen = allBytesString.length();		for (int i = 0; (i < (Byte.MAX_VALUE - Byte.MIN_VALUE))				&& (i < allBytesStringLen); i++) {			byteToChars[i] = allBytesString.charAt(i);		}		try {			toPlainStringMethod = BigDecimal.class.getMethod("toPlainString",					new Class[0]);		} catch (NoSuchMethodException nsme) {			// that's okay, we fallback to .toString()		}	}	/**	 * Takes care of the fact that Sun changed the output of	 * BigDecimal.toString() between JDK-1.4 and JDK 5	 * 	 * @param decimal	 *            the big decimal to stringify	 * 	 * @return a string representation of 'decimal'	 */	public static String consistentToString(BigDecimal decimal) {		if (decimal == null) {			return null;		}		if (toPlainStringMethod != null) {			try {				return (String) toPlainStringMethod.invoke(decimal, null);			} catch (InvocationTargetException invokeEx) {				// that's okay, we fall-through to decimal.toString()			} catch (IllegalAccessException accessEx) {				// that's okay, we fall-through to decimal.toString()			}		}		return decimal.toString();	}	/**	 * Dumps the given bytes to STDOUT as a hex dump (up to length bytes).	 * 	 * @param byteBuffer	 *            the data to print as hex	 * @param length	 *            the number of bytes to print	 * 	 * @return ...	 */	public static final String dumpAsHex(byte[] byteBuffer, int length) {		StringBuffer outputBuf = new StringBuffer(length * 4);		int p = 0;		int rows = length / 8;		for (int i = 0; (i < rows) && (p < length); i++) {			int ptemp = p;			for (int j = 0; j < 8; j++) {				String hexVal = Integer.toHexString(byteBuffer[ptemp] & 0xff);				if (hexVal.length() == 1) {					hexVal = "0" + hexVal; //$NON-NLS-1$				}				outputBuf.append(hexVal + " "); //$NON-NLS-1$				ptemp++;			}			outputBuf.append("    "); //$NON-NLS-1$			for (int j = 0; j < 8; j++) {				if ((byteBuffer[p] > 32) && (byteBuffer[p] < 127)) {					outputBuf.append((char) byteBuffer[p] + " "); //$NON-NLS-1$				} else {					outputBuf.append(". "); //$NON-NLS-1$				}				p++;			}			outputBuf.append("\n"); //$NON-NLS-1$		}		int n = 0;		for (int i = p; i < length; i++) {			String hexVal = Integer.toHexString(byteBuffer[i] & 0xff);			if (hexVal.length() == 1) {				hexVal = "0" + hexVal; //$NON-NLS-1$			}			outputBuf.append(hexVal + " "); //$NON-NLS-1$			n++;		}		for (int i = n; i < 8; i++) {			outputBuf.append("   "); //$NON-NLS-1$		}		outputBuf.append("    "); //$NON-NLS-1$		for (int i = p; i < length; i++) {			if ((byteBuffer[i] > 32) && (byteBuffer[i] < 127)) {				outputBuf.append((char) byteBuffer[i] + " "); //$NON-NLS-1$			} else {				outputBuf.append(". "); //$NON-NLS-1$			}		}		outputBuf.append("\n"); //$NON-NLS-1$		return outputBuf.toString();	}	private static boolean endsWith(byte[] dataFrom, String suffix) {		for (int i = 1; i <= suffix.length(); i++) {			int dfOffset = dataFrom.length - i;			int suffixOffset = suffix.length() - i;			if (dataFrom[dfOffset] != suffix.charAt(suffixOffset)) {				return false;			}		}		return true;	}	/**	 * Unfortunately, SJIS has 0x5c as a high byte in some of its double-byte	 * characters, so we need to escape it.	 * 	 * @param origBytes	 *            the original bytes in SJIS format	 * @param origString	 *            the string that had .getBytes() called on it	 * @param offset	 *            where to start converting from	 * @param length	 *            how many characters to convert.	 * 	 * @return byte[] with 0x5c escaped	 */	public static byte[] escapeEasternUnicodeByteStream(byte[] origBytes,			String origString, int offset, int length) {		if ((origBytes == null) || (origBytes.length == 0)) {			return origBytes;		}		int bytesLen = origBytes.length;		int bufIndex = 0;		int strIndex = 0;		ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(bytesLen);		while (true) {			if (origString.charAt(strIndex) == '\\') {				// write it out as-is				bytesOut.write(origBytes[bufIndex++]);				// bytesOut.write(origBytes[bufIndex++]);			} else {				// Grab the first byte				int loByte = origBytes[bufIndex];				if (loByte < 0) {					loByte += 256; // adjust for signedness/wrap-around				}				// We always write the first byte				bytesOut.write(loByte);				//				// The codepage characters in question exist between				// 0x81-0x9F and 0xE0-0xFC...				//				// See:				//				// http://www.microsoft.com/GLOBALDEV/Reference/dbcs/932.htm				//				// Problematic characters in GBK				//				// U+905C : CJK UNIFIED IDEOGRAPH				//				// Problematic characters in Big5				//				// B9F0 = U+5C62 : CJK UNIFIED IDEOGRAPH				//				if (loByte >= 0x80) {					if (bufIndex < (bytesLen - 1)) {						int hiByte = origBytes[bufIndex + 1];						if (hiByte < 0) {							hiByte += 256; // adjust for signedness/wrap-around						}						// write the high byte here, and increment the index						// for the high byte						bytesOut.write(hiByte);						bufIndex++;						// escape 0x5c if necessary						if (hiByte == 0x5C) {							bytesOut.write(hiByte);						}					}				} else if (loByte == 0x5c) {					if (bufIndex < (bytesLen - 1)) {						int hiByte = origBytes[bufIndex + 1];						if (hiByte < 0) {							hiByte += 256; // adjust for signedness/wrap-around						}						if (hiByte == 0x62) {							// we need to escape the 0x5c							bytesOut.write(0x5c);							bytesOut.write(0x62);							bufIndex++;						}					}				}				bufIndex++;			}			if (bufIndex >= bytesLen) {				// we're done				break;			}			strIndex++;		}		return bytesOut.toByteArray();	}	/**	 * Returns the first non whitespace char, converted to upper case	 * 	 * @param searchIn	 *            the string to search in	 * 	 * @return the first non-whitespace character, upper cased.	 */	public static char firstNonWsCharUc(String searchIn) {		return firstNonWsCharUc(searchIn, 0);	}		public static char firstNonWsCharUc(String searchIn, int startAt) {		if (searchIn == null) {			return 0;		}		int length = searchIn.length();		for (int i = startAt; i < length; i++) {			char c = searchIn.charAt(i);			if (!Character.isWhitespace(c)) {				return Character.toUpperCase(c);			}		}		return 0;	}	/**	 * Adds '+' to decimal numbers that are positive (MySQL doesn't understand	 * them otherwise	 * 	 * @param dString	 *            The value as a string	 * 	 * @return String the string with a '+' added (if needed)	 */	public static final String fixDecimalExponent(String dString) {		int ePos = dString.indexOf("E"); //$NON-NLS-1$		if (ePos == -1) {			ePos = dString.indexOf("e"); //$NON-NLS-1$		}		if (ePos != -1) {			if (dString.length() > (ePos + 1)) {				char maybeMinusChar = dString.charAt(ePos + 1);				if (maybeMinusChar != '-' && maybeMinusChar != '+') {					StringBuffer buf = new StringBuffer(dString.length() + 1);					buf.append(dString.substring(0, ePos + 1));					buf.append('+');					buf.append(dString.substring(ePos + 1, dString.length()));					dString = buf.toString();				}			}		}		return dString;	}	public static final byte[] getBytes(char[] c,			SingleByteCharsetConverter converter, String encoding,			String serverEncoding, boolean parserKnowsUnicode)			throws SQLException {		try {			byte[] b = null;			if (converter != null) {				b = converter.toBytes(c);			} else if (encoding == null) {				b = new String(c).getBytes();			} else {				String s = new String(c);				b = s.getBytes(encoding);				if (!parserKnowsUnicode && (encoding.equalsIgnoreCase("SJIS") //$NON-NLS-1$						|| encoding.equalsIgnoreCase("BIG5") //$NON-NLS-1$				|| encoding.equalsIgnoreCase("GBK"))) { //$NON-NLS-1$					if (!encoding.equalsIgnoreCase(serverEncoding)) {						b = escapeEasternUnicodeByteStream(b, s, 0, s.length());					}				}			}			return b;		} catch (UnsupportedEncodingException uee) {			throw SQLError.createSQLException(Messages.getString("StringUtils.5") //$NON-NLS-1$					+ encoding + Messages.getString("StringUtils.6"),					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$		}	}	public static final byte[] getBytes(char[] c,			SingleByteCharsetConverter converter, String encoding,			String serverEncoding, int offset, int length,			boolean parserKnowsUnicode) throws SQLException {		try {			byte[] b = null;			if (converter != null) {				b = converter.toBytes(c, offset, length);			} else if (encoding == null) {				byte[] temp = new String(c, offset, length).getBytes();				length = temp.length;								b = new byte[length];				System.arraycopy(temp, 0, b, 0, length);			} else {				String s = new String(c, offset, length);				byte[] temp = s.getBytes(encoding);				length = temp.length;								b = new byte[length];				System.arraycopy(temp, 0, b, 0, length);				if (!parserKnowsUnicode && (encoding.equalsIgnoreCase("SJIS") //$NON-NLS-1$						|| encoding.equalsIgnoreCase("BIG5") //$NON-NLS-1$				|| encoding.equalsIgnoreCase("GBK"))) { //$NON-NLS-1$					if (!encoding.equalsIgnoreCase(serverEncoding)) {						b = escapeEasternUnicodeByteStream(b, s, offset, length);					}				}			}			return b;		} catch (UnsupportedEncodingException uee) {			throw SQLError.createSQLException(Messages.getString("StringUtils.10") //$NON-NLS-1$					+ encoding + Messages.getString("StringUtils.11"),					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$		}	}	public static final byte[] getBytes(char[] c, String encoding,			String serverEncoding, boolean parserKnowsUnicode, Connection conn)			throws SQLException {		try {						SingleByteCharsetConverter converter = null;						if (conn != null) {				converter = conn.getCharsetConverter(encoding);			} else {				converter = SingleByteCharsetConverter.getInstance(encoding, null);			}			return getBytes(c, converter, encoding, serverEncoding,					parserKnowsUnicode);		} catch (UnsupportedEncodingException uee) {			throw SQLError.createSQLException(Messages.getString("StringUtils.0") //$NON-NLS-1$					+ encoding + Messages.getString("StringUtils.1"),					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$		}	}	/**	 * Returns the byte[] representation of the given string (re)using the given	 * charset converter, and the given encoding.	 * 	 * @param s	 *            the string to convert	 * @param converter	 *            the converter to reuse	 * @param encoding	 *            the character encoding to use	 * @param serverEncoding	 *            DOCUMENT ME!	 * @param parserKnowsUnicode	 *            DOCUMENT ME!	 * 	 * @return byte[] representation of the string	 * 	 * @throws SQLException	 *             if an encoding unsupported by the JVM is supplied.	 */	public static final byte[] getBytes(String s,			SingleByteCharsetConverter converter, String encoding,			String serverEncoding, boolean parserKnowsUnicode)			throws SQLException {		try {			byte[] b = null;			if (converter != null) {				b = converter.toBytes(s);			} else if (encoding == null) {				b = s.getBytes();			} else {				b = s.getBytes(encoding);				if (!parserKnowsUnicode && (encoding.equalsIgnoreCase("SJIS") //$NON-NLS-1$						|| encoding.equalsIgnoreCase("BIG5") //$NON-NLS-1$				|| encoding.equalsIgnoreCase("GBK"))) { //$NON-NLS-1$					if (!encoding.equalsIgnoreCase(serverEncoding)) {						b = escapeEasternUnicodeByteStream(b, s, 0, s.length());					}				}			}			return b;		} catch (UnsupportedEncodingException uee) {			throw SQLError.createSQLException(Messages.getString("StringUtils.5") //$NON-NLS-1$					+ encoding + Messages.getString("StringUtils.6"),					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$		}	}	/**	 * DOCUMENT ME!	 * 	 * @param s	 *            DOCUMENT ME!	 * @param converter	 *            DOCUMENT ME!	 * @param encoding	 *            DOCUMENT ME!	 * @param serverEncoding	 *            DOCUMENT ME!	 * @param offset	 *            DOCUMENT ME!	 * @param length	 *            DOCUMENT ME!	 * @param parserKnowsUnicode	 *            DOCUMENT ME!

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲伦理在线免费看| 一区二区三区欧美视频| 国产综合色视频| 欧美高清视频一二三区| 亚洲一区二区三区四区在线免费观看| 91免费国产在线| 亚洲欧洲三级电影| 色天使久久综合网天天| 亚洲天堂av一区| 欧美精品 日韩| 国产激情视频一区二区三区欧美| 午夜伦欧美伦电影理论片| 丰满岳乱妇一区二区三区| 欧美电影免费观看高清完整版在线| 亚洲人被黑人高潮完整版| 国产99一区视频免费| 精品av久久707| 六月丁香婷婷久久| 欧美三区免费完整视频在线观看| **性色生活片久久毛片| 国产91色综合久久免费分享| 精品成人佐山爱一区二区| 日韩中文字幕91| 欧美日韩1234| 亚洲高清免费视频| 欧美私人免费视频| 亚洲国产成人av网| 欧美午夜影院一区| 亚洲一区欧美一区| 欧美视频在线观看一区| 亚洲图片有声小说| 在线观看国产精品网站| 一区二区三区日韩欧美| 欧美性猛交xxxx黑人交| 亚洲国产一区二区在线播放| 欧美日韩精品电影| 天天色综合成人网| 日韩欧美激情在线| 国产一区二区不卡| 国产精品天干天干在观线| 成人污视频在线观看| 自拍偷拍欧美激情| 精品污污网站免费看| 日韩av电影一区| xnxx国产精品| 99久久99久久精品免费看蜜桃| 综合久久久久久| 欧美日韩在线播放| 久久精品免费看| 国产精品区一区二区三| 91久久久免费一区二区| 一区二区三区四区不卡视频| 久久电影网电视剧免费观看| 成人丝袜高跟foot| 欧美一卡二卡在线| wwwwww.欧美系列| 国产精品卡一卡二卡三| 婷婷成人激情在线网| 51精品视频一区二区三区| 欧美一级日韩免费不卡| 国产午夜亚洲精品理论片色戒| 26uuu成人网一区二区三区| 亚洲高清视频中文字幕| 国产日韩欧美a| 99久久精品99国产精品| 五月激情综合色| 久久久久久一二三区| 色先锋aa成人| 国内精品免费在线观看| 亚洲欧洲精品天堂一级| 欧美一区二区三区白人| 丁香天五香天堂综合| 亚洲超碰精品一区二区| 国产拍欧美日韩视频二区| 在线亚洲免费视频| 国产成人一级电影| 婷婷综合另类小说色区| 国产欧美精品一区二区三区四区| 欧美日韩一区视频| av成人动漫在线观看| 美女任你摸久久| 亚洲一二三专区| 中文字幕成人在线观看| 欧美成人video| 欧美亚一区二区| 成人av影院在线| 韩国女主播一区| 亚洲成人在线免费| 中文字幕一区二区三区视频| 精品久久久久久无| 欧美日韩的一区二区| 91丝袜美腿高跟国产极品老师| 国内精品伊人久久久久av一坑 | 一区二区三区美女视频| www国产精品av| 欧美一区二区三区免费观看视频 | 91精品国产日韩91久久久久久| 成人的网站免费观看| 国产在线精品国自产拍免费| 亚洲成人动漫av| 亚洲最新视频在线观看| 亚洲日本va午夜在线影院| 中文字幕av一区 二区| 国内成人自拍视频| 欧美激情一区二区三区| 日韩欧美一区二区久久婷婷| 国产精品中文字幕日韩精品 | 一区二区三区四区视频精品免费| 国产精品一区二区黑丝| 亚洲午夜一区二区| 日韩亚洲欧美成人一区| 一本大道久久a久久精品综合| 久久se精品一区精品二区| 视频在线观看一区| 18涩涩午夜精品.www| 国产精品久久看| 亚洲天堂精品在线观看| 亚洲精品日韩专区silk| 亚洲精品高清在线| 亚洲一区在线看| 日韩精品久久久久久| 日本不卡123| 久久99国内精品| 国产精品亚洲专一区二区三区| 国产精品996| 国产91精品久久久久久久网曝门| 国产成人av电影在线| eeuss鲁片一区二区三区| 色综合久久久久网| 欧美日韩一级视频| 日韩欧美综合在线| 欧美一区二区三区在线观看视频 | 久久成人av少妇免费| 免费成人深夜小野草| 狠狠色丁香久久婷婷综| 成人午夜精品在线| 色妞www精品视频| 欧美日韩免费观看一区三区| 日韩午夜精品视频| 国产欧美日本一区二区三区| 亚洲视频一区在线| 调教+趴+乳夹+国产+精品| 国产一区在线精品| 色先锋aa成人| 精品国产亚洲一区二区三区在线观看| 日本一区二区视频在线| 亚洲精品日日夜夜| 激情综合网av| 色婷婷国产精品综合在线观看| 欧美精品乱人伦久久久久久| 国产亚洲精久久久久久| 亚洲一区在线观看免费观看电影高清 | 日本一区二区三区在线不卡| 亚洲另类春色校园小说| 精品一区二区久久久| 丁香婷婷综合网| 欧美日韩在线三区| 亚洲一线二线三线视频| 国产成人av一区二区| 欧美日本精品一区二区三区| 久久精品视频一区二区| 日韩福利视频网| 一本久久精品一区二区| 欧美xxxxx牲另类人与| 一区二区三区资源| 国产91丝袜在线观看| 6080亚洲精品一区二区| 亚洲妇熟xx妇色黄| 欧美日本精品一区二区三区| 精品成人一区二区三区四区| 亚洲成av人片一区二区梦乃| 成人一区二区视频| 日韩视频在线你懂得| 亚洲福利视频一区| 91日韩一区二区三区| 欧美国产激情一区二区三区蜜月| 男男视频亚洲欧美| 欧美精品电影在线播放| 成人免费一区二区三区在线观看| 欧美日韩精品欧美日韩精品一| 亚洲国产精品视频| jizz一区二区| 国产欧美一区二区三区网站| 美国十次综合导航| 日韩欧美国产1| 日韩电影网1区2区| 91精品国产色综合久久不卡蜜臀| 亚洲综合清纯丝袜自拍| 91啪亚洲精品| 中文字幕综合网| 91尤物视频在线观看| 亚洲手机成人高清视频| 成人丝袜高跟foot| 中文字幕亚洲视频| 99在线视频精品| 亚洲欧洲日韩女同| 99国产精品久久久久| 日韩毛片一二三区| 91成人在线免费观看| 亚洲一二三专区|