Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVA×Ö·û´®Àà

import java.util.*;
import java.util.regex.Pattern;
public class StrTools {
/**
* ·Ö¸î×Ö·û´®
*
* @param str String ԭʼ×Ö·û´®
* @param splitsign String ·Ö¸ô·û
* @return String[] ·Ö¸îºóµÄ×Ö·û´®Êý×é
*/
@SuppressWarnings("unchecked")
public static String[] split(String str, String splitsign) {
int index;
if (str == null || splitsign == null)
return null;
ArrayList al = new ArrayList();
while ((index = str.indexOf(splitsign)) != -1) {
al.add(str.substring(0, index));
str = str.substring(index + splitsign.length());
}
al.add(str);
return (String[]) al.toArray(new String[0]);
}
/**
* Ìæ»»×Ö·û´®
*
* @param from String ԭʼ×Ö·û´®
* @param to String Ä¿±ê×Ö·û´®
* @param source String ĸ×Ö·û´®
* @return String Ìæ»»ºóµÄ×Ö·û´®
*/
public static String replace(String from, String to, String source) {
if (source == null || from == null || to == null)
return null;
StringBuffer bf = new StringBuffer("");
int index = -1;
while ((index = source.indexOf(from)) != -1) {
bf.append(source.substring(0, index) + to);
source = source.substring(index + from.length());
index = source.indexOf(from);
}
bf.append(source);
return bf.toString();
}
/**
* Ìæ»»×Ö·û´®£¬ÄÜÄܹ»ÔÚHTMLÒ³ÃæÉÏÖ±½ÓÏÔʾ(Ìæ»»Ë«ÒýºÅºÍСÓÚºÅ)
*
* @param str String ԭʼ×Ö·û´®
* @return String Ìæ»»ºóµÄ×Ö·û´®
*/
public static String htmlencode(String str) {
if (str == null) {
return null;
}
return replace("\"", """, replace("<", "<", str));
}
/**
* Ìæ»»×Ö·û´®£¬½«±»±àÂëµÄת»»³ÉԭʼÂë£¨Ìæ»»³ÉË«ÒýºÅºÍСÓںţ©
*
* @param str String
* @return String
*/
public static String htmldecode(String str) {
if (str == null) {
return null;
}
return replace(""", "\"", replace("<", "<", str));
}
private static final String _BR = "<br/>"


Ïà¹ØÎĵµ£º

ZlibѹËõËã·¨ÔÚjavaÉϵÄÓ¦ÓÃ

JAVAʵÏÖ
¡¡¡¡ÔÚJDKÖУ¬ÔÚjava.util.zip°üÖÐÒѾ­ÄÚÖÃÁËZLIBµÄʵÏÖ£¬Ê¾Àý´úÂëÈçÏ£º
1//½âѹ
2 public String decompressData(String encdata) {
3 try {
4 ByteArrayOutputStream bos = new ByteArrayOutputStream(); 
5 InflaterOutputStream zos = new InflaterOutputStream(bos); 
6 zo ......

javaÉè¼ÆÄ£Ê½Ñ§Ï°1£­£­Singleton Pattern

javaÉè¼ÆÄ£Ê½Ñ§Ï°1£­£­Singleton Pattern
¡¡¡¡Ç°Ð©Ìì°ÚŪjava£¬²Î¿¼Ò»Ð©×ÊÁÏдÁ˸öÊý¾Ý¿âÁ¬½Ó³Ø£¬¶ÔÀïÃæÖ»²úÉúÒ»¸öʵÀýµÄÄÇÖÖ×ö·¨Éî±íÅå·þ£¬½ñÌìÖÐÎçÓÖÌýµ½±ðÈËÔÚ˵Éè¼ÆÄ£Ê½£¬Êܲ»ÁËÁË£¬¾ÍÉÏÍøDownÁ˵ã×ÊÁÏÀ´¡£
¡¡¡¡Ò»À´¾Í¿´µ½ÁËSingletonģʽ£¬Ò»¿´£¬Ñ½£¬²»¾ÍÊÇÄǸöÁ¬½Ó³ØÀïÓõķ½·¨Ã´?!àÞ£¬Ô­À´Èç´Ë¡£
¡¡¡¡Singleton Ê ......

JAVAÅäÖû·¾³±äÁ¿

ÔÚwindows×ÀÃæÉÏÓÒ»÷“ÎҵĵçÄÔ” —> “ÊôÐÔ” —> “¸ß¼¶” —> “»·¾³±äÁ¿”£¬Ôړϵͳ±äÁ¿”ÀïÎÒÃÇ¿ÉÒÔ¿´µ½ÏµÍ³µÄ¸÷¸ö»·¾³±äÁ¿µÄÖµ¡£Ë«»÷ij¸ö±äÁ¿Ãû¿ÉÒÔÐ޸ıäÁ¿Öµ£¬±äÁ¿ÖµÖ®¼äÓÓ;”¸ô¿ª¡£ÎÒÃÇ»¹¿ÉÒԓн¨”Ô­ÏÈÃ»Ó ......

Java ClassLoader ·ÖÎö

ÏÈÌùÒ»¶Î
Java
»ù±¾½á¹¹
Java
½á¹¹°üÀ¨Ëĸö²»Í¬¶øÓÖÏà¹ØµÄ²¿·Ö£º
Java
ÓïÑÔ¡¢
class
Îļþ¸ñʽ¡¢Ó¦ÓóÌÐò½Ó
¿Ú¡¢ÐéÄâ»ú
ÆäÖУ¬ÐéÄâ»úµÄÖ÷ÒªÈÎÎñÊÇÔÚ³ÌÐòÔËÐÐÖÐÐèÒªµÄʱºòµ÷ÓÃ
class
Îļþ²¢Ö´ÐÐÆäÖеÄ×Ö½ÚÂë¡£Ò»¸ö
Java
Ó¦
ÓÃÓÐÁ½ÖÖ
class loader
£º
the system class loader
ºÍ
class loader objects ......

JAVAÊý¾Ý¿âÁ¬½Ó´óÈ«

1¡¢Oracle8/8i/9iÊý¾Ý¿â£¨thinģʽ£©
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl"; //orclΪÊý¾Ý¿âµÄSID
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);
 
2¡¢DB ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ