ÀûÓÃjavaÐòÁл¯·´ÐòÁл¯ ʵÏÖ·ÒëÀý×Ó
xmlÖмüÃûΪ Ó¢ÎÄ£¬¼üֵΪÖÐÎÄ£¬¶ÁÈ¡½âÎö£¬È¡ÖµÊµÏÖ·Òë
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/*******************************************************************************
* ÐòÁл¯¶ÔÏóµ½xmlÎļþ
*
* @author zzbk_c8
*
*/
public class ObjectToXMLUtil {
/***************************************************************************
* ÐòÁл¯·½·¨
*
* @param objÐòÁл¯¶ÔÏó
* @param fileName´æ·ÅµØÖ·
*/
public static void objectXmlEncoder(Object obj, String fileName) {
// ´´½¨Îļþ
File file = new File(fileName);
// ÅжÏÎļþÊÇ·ñ´æÔÚ£¬Èç²»´æÔÚ´´½¨
if (!file.exists()) {
// ÏÈ´´½¨ÎļþĿ¼
File filePath = new File(fileName.substring(0, fileName
.lastIndexOf("/")));
filePath.mkdirs();
}
try {
// ´´½¨ÎļþµÄÊä³öÁ÷
FileOutputStream out = new FileOutputStream(fileName);
// ´´½¨XMLÎļþ¶ÔÏóÊä³öÀà
XMLEncoder xmlEncoder = new XMLEncoder(out);
// ÀûÓÃxml¶ÔÏóÊä³öÀàÊä³ö¶ÔÏóµ½xmlÎļþ
xmlEncoder.writeObject(obj);
xmlEncoder.flush();
// ¹Ø±ÕÊä³ö¶ÔÏó
xmlEncoder.close();
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("ÎļþÊä³öÁ÷¹Ø±Õ´íÎó");
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("ÎļþÊä³öÁ÷´´½¨Ê§°Ü");
e.printStackTrace();
}
}
/***************************************************************************
* ·´ÐòÁл¯
*
* @param objSource
* xmlÎļþ£¬·´ÐòÁл¯ÄÚÈÝ
* @return ·µ»Ø¼¯ºÏ
*/
public static List objectXmlDecoder(String objSource) {
/
Ïà¹ØÎĵµ£º
ÏÈÉùÃ÷һϣ¬ÌâÄ¿Ô³öÓÚ£ºhttp://gocom.primeton.com/modules/newbb/item60284_60284.htm
JVMÊÇJava³ÌÐòµÄÔËÐл·¾³£¬Òò´Ë¶ÔÓÚJVMµÄÕÆÎÕÓÐÖúÓÚÀí½âJava³ÌÐòµÄÖ´ÐÐÒÔ¼°±àд£¬ÓÈÆäÊÇÔËÐÐʱÅöµ½µÄһЩ¹îÒìÎÊÌ⣬ÄÇôÔõôÑùÄÜ¿¼²ì×Ô¼º¶ÔÓÚJVM¹Ø¼ü֪ʶµãµÄÕÆÎÕÇé¿ö£¬°ïÖúѧϰJVM»úÖÆÄØ£¬ÔÚÕâƪblogÖÐÀ´Ì½ÌÖÏ¡£
¶ÔÓÚJava³ÌÐò¶øÑ ......
±¾ÎĽ²½âÁËJavaÐòÁл¯µÄ»úÖƺÍÔÀí¡£´ÓÎÄÖÐÄã¿ÉÒÔÁ˽âÈçºÎÐòÁл¯Ò»¸ö¶ÔÏó£¬Ê²Ã´Ê±ºòÐèÒªÐòÁл¯ÒÔ¼°JavaÐòÁл¯µÄËã·¨¡£
00 00 00 0B: 11, containVersionµÄÖµ.
0x70:TC_NULL£¬Ã»Óг¬ÀàÁË¡£
0x49: ÓòÀàÐÍ. 49 ´ú±í"I", Ò²¾ÍÊÇInt..
00 0E: ÓòÃû×Ö³¤¶ ......
·½°¸Ò»²½Ö裺
1¡¢ÅäÖÃTomcat\conf\context.xmlÌí¼Ó <Resource>
<Resource name="jdbc/books" auth="Container"
type="javax.sql.DataSource" maxActive="100" maxIdle="30"
maxWait="10000" username="sa" password=""
driverClassName="com.microsoft.jdbc.sqlse ......