java ÐòÁл¯£¨Serializable£©
1.Java ÐòÁл¯¼¼Êõ¿ÉÒÔʹÄ㽫һ¸ö¶ÔÏóµÄ״̬дÈëÒ»¸öByte Á÷À²¢ÇÒ¿ÉÒÔ´ÓÆäËüµØ·½
°Ñ¸ÃByte Á÷ÀïµÄÊý¾Ý¶Á³öÀ´¡£ÖØÐ¹¹ÔìÒ»¸öÏàͬµÄ¶ÔÏó¡£ÕâÖÖ»úÖÆÔÊÐíÄ㽫¶ÔÏóͨ¹ýÍøÂç
½øÐд«²¥£¬²¢¿ÉÒÔËæÊ±°Ñ¶ÔÏó³Ö¾Ã»¯µ½Êý¾Ý¿â¡¢ÎļþµÈϵͳÀï¡£JavaµÄÐòÁл¯»úÖÆÊÇRMI¡¢
EJB¡¢JNNIµÈ¼¼ÊõµÄ¼¼Êõ»ù´¡
2.²¢·ÇËùÓеÄJava Àà¶¼¿ÉÒÔÐòÁл¯£¬ÎªÁËʹÄãÖ¸¶¨µÄÀà¿ÉÒÔʵÏÖÐòÁл¯£¬Äã±ØÐëʹ¸ÃÀà
ʵÏÖÈçϽӿڣº
java.io.Serializable
ÐèҪעÒâµÄÊÇ£¬¸Ã½Ó¿Úʲô·½·¨Ò²Ã»ÓС£ÊµÏÖ¸ÃÀàÖ»ÊǼòµ¥µÄ±ê¼ÇÄãµÄÀà×¼±¸Ö§³ÖÐòÁÐ
»¯¹¦ÄÜ¡£
3.µ±Á½¸ö½ø³ÌÔÚ½øÐÐÔ¶³ÌͨÐÅʱ£¬±Ë´Ë¿ÉÒÔ·¢Ë͸÷ÖÖÀàÐ͵ÄÊý¾Ý¡£ÎÞÂÛÊǺÎÖÖÀàÐ͵ÄÊý¾Ý£¬¶¼»áÒÔ¶þ½øÖÆÐòÁеÄÐÎʽÔÚÍøÂçÉÏ´«ËÍ¡£·¢ËÍ·½ÐèÒª°ÑÕâ¸öJava¶ÔÏóת»»Îª×Ö½ÚÐòÁУ¬²ÅÄÜÔÚÍøÂçÉÏ´«ËÍ£»½ÓÊÕ·½ÔòÐèÒª°Ñ×Ö½ÚÐòÁÐÔÙ»Ö¸´ÎªJava¶ÔÏó¡£
°ÑJava¶ÔÏóת»»Îª×Ö½ÚÐòÁеĹý³Ì³ÆÎª¶ÔÏóµÄÐòÁл¯¡£
°Ñ×Ö½ÚÐòÁлָ´ÎªJava¶ÔÏóµÄ¹ý³Ì³ÆÎª¶ÔÏóµÄ·´ÐòÁл¯¡£
4.java.io.ObjectOutputStream´ú±í¶ÔÏóÊä³öÁ÷£¬ËüµÄwriteObject(Object obj)·½·¨¿É¶Ô²ÎÊýÖ¸¶¨µÄobj¶ÔÏó½øÐÐÐòÁл¯£¬°ÑµÃµ½µÄ×Ö½ÚÐòÁÐдµ½Ò»¸öÄ¿±êÊä³öÁ÷ÖС£
java.io.ObjectInputStream´ú±í¶ÔÏóÊäÈëÁ÷£¬ËüµÄreadObject()·½·¨´ÓÒ»¸öÔ´ÊäÈëÁ÷ÖжÁÈ¡×Ö½ÚÐòÁУ¬ÔÙ°ÑËüÃÇ·´ÐòÁл¯ÎªÒ»¸ö¶ÔÏ󣬲¢½«Æä·µ»Ø¡£
Ö»ÓÐʵÏÖÁËSerializableºÍExternalizable½Ó¿ÚµÄÀàµÄ¶ÔÏó²ÅÄܱ»ÐòÁл¯¡£Externalizable½Ó¿Ú¼Ì³Ð×ÔSerializable½Ó¿Ú£¬ÊµÏÖExternalizable½Ó¿ÚµÄÀàÍêÈ«ÓÉ×ÔÉíÀ´¿ØÖÆÐòÁл¯µÄÐÐΪ£¬¶ø½öʵÏÖSerializable½Ó¿ÚµÄÀà¿ÉÒÔ²ÉÓÃĬÈϵÄÐòÁл¯·½Ê½ ¡£
5. ¶ÔÏóÐòÁл¯°üÀ¨Èçϲ½Ö裺
1£© ´´½¨Ò»¸ö¶ÔÏóÊä³öÁ÷£¬Ëü¿ÉÒÔ°ü×°Ò»¸öÆäËûÀàÐ͵ÄÄ¿±êÊä³öÁ÷£¬ÈçÎļþÊä³öÁ÷£»
2£© ͨ¹ý¶ÔÏóÊä³öÁ÷µÄwriteObject()·½·¨Ð´¶ÔÏó¡£
¶ÔÏó·´ÐòÁл¯µÄ²½ÖèÈçÏ£º
1£© ´´½¨Ò»¸ö¶ÔÏóÊäÈëÁ÷£¬Ëü¿ÉÒÔ°ü×°Ò»¸öÆäËûÀàÐ͵ÄÔ´ÊäÈëÁ÷£¬ÈçÎļþÊäÈëÁ÷£»
2£© ͨ¹ý¶ÔÏóÊäÈëÁ÷µÄreadObject()·½·¨¶ÁÈ¡¶ÔÏó¡£
ÊäÈëÊä³öÁ÷
String filepath = "D://objoutputfile.obj";//³Ö¾Ã»¯Îļþ
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filepath));
ObjectInputStream is = new ObjectInputStream(new FileInputStream(filepath));
Ïà¹ØÎĵµ£º
1¡¢ÀûÓÃSystem.getProperty()º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dirÖ¸¶¨Á˵±Ç°µÄ·¾¶
2¡¢Ê¹ÓÃFileÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");//É趨Ϊµ±Ç°Îļþ¼Ð
try{
System.out.println(directory.get ......
ÕâÒ»ÓÐ¹Ø Java ±à³Ì¶¯Ì¬·½ÃæµÄеÄϵÁÐÎÄÕÂÑо¿ÁËÖ´ÐÐ Java Ó¦ÓóÌÐòʱĻºóËù·¢ÉúµÄÊÂÇé¡£ÆóÒµ Javaר¼Ò
Dennis Sosnoski ÌṩÁË Java ¶þ½øÖÆÀà¸ñʽÒÔ¼°ÔÚ JVM
ÄÚ²¿ÀàËù·¢ÉúµÄÇé¿öµÄÄÚÄ»¡£½Ó×Å£¬Ëû½«ÌÖÂÛÀà×°ÈëÎÊÌ⣬Æä·¶Î§Éæ¼°´ÓÔËÐмòµ¥µÄ Java Ó¦ÓóÌÐòËùÐèµÄÀàµÄÊýÁ¿µ½¿ÉÄÜÔì³É J2EE
¼°ÀàËÆµÄ¸´ÔÓÌåϵ½á¹¹³öÏÖÎÊÌâµÄ ......
ÔÚ¾¹ýÒ»¶Îʱ¼äµÄÐÝÏ¢Ö®ºó£¬Dennis Sosnoski ÓÖ»ØÀ´ÍƳöÁËËûµÄ
Java ±à³ÌµÄ¶¯Ì¬ÐÔ
ϵ
ÁÐµÄµÚ 5 ²¿·Ö¡£ÄúÒÑÔÚÇ°ÃæµÄÎÄÕÂÖп´µ½ÁËÈçºÎ±àдÓÃÓÚת»» Java ÀàÎļþÒԸıä´úÂëÐÐΪµÄ³ÌÐò¡£ÔÚ±¾ÆÚÖУ¬Dennis½«Õ¹Ê¾ÈçºÎʹÓÃ
Javassist
¿ò¼Ü£¬°Ñת»»Óëʵ¼ÊµÄÀà¼ÓÔØ¹ý³Ì½áºÏÆðÀ´£¬ÓÃÒÔ½øÐÐÁé»îµÄ“¼´Ê±”ÃæÏò·½Ã ......
package cn.eshore.mismp.sms.ws.send;
public class Base64 {
/**
* ½«ÔʼÊý¾Ý±àÂëΪbase64±àÂë
*/
static public char[] encode(byte[] data) {
char[] out = new char[((data.length + 2) / 3) * 4];
for (int i = 0, index = 0; i < data.length; i += 3, index += 4) {
boolean quad = false ......
Íæ¹ýPSPµÄÅóÓÑÃÇ£¬Ïë±Ø¶¼Ìý˵¹ý¡¶ÓÂÕß30¡·µÄ´óÃû°É£¿àÅ£¬Ã»´í£¬ÎÒ˵µÄ¾ÍÊÇÄÇ¿î±ØÐëÔÚ30ÃëÄÚͨ¹ØµÄ±ä̬ÓÎÏ·¡£
´Ó±íÃæÉÏ¿´£¬¡¶ÓÂÕß30¡·µÄÓÎϷģʽÔÙ¼òµ¥²»¹ý£¬ÎÞ·ÇÊÇ´«Í³µÄRPGÓÎÏ·ÄÇÑù´ò¹Ö¡¢Á·¼¶¡¢Íê³ÉÖ§ÏßÈÎÎñ¡¢ÌáÉý×°±¸¡¢Ì½ÏÕ¡¢ÏûÃðħÍõ½áÊøÓÎÏ·¡£µ«ÊÇ£¬ËùÓÐÊܹýÆä¶¾º¦µÄÅóÓѶ¼Çå³þ£¬ÕâЩҲ½ö½öÊDZíÃæÏÖÏó°ÕÁË¡£
ÒòΪÕâËù ......