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

Java Properties Àà¶ÁÈ¡ÅäÖÃÎļþÐÅÏ¢

ÔÚÎÒÃÇƽʱд³ÌÐòµÄʱºò£¬ÓÐЩ²ÎÊýÊǾ­³£¸Ä±äµÄ£¬¶øÕâÖָı䲻ÊÇÎÒÃÇÔ¤ÖªµÄ¡£±ÈÈç˵ÎÒÃÇ¿ª·¢ÁËÒ»¸ö²Ù×÷Êý¾Ý¿âµÄÄ£¿é£¬ÔÚ¿ª·¢µÄʱºòÎÒÃÇÁ¬½Ó±¾µØµÄÊý¾Ý¿âÄÇô IP £¬Êý¾Ý¿âÃû³Æ£¬±íÃû³Æ£¬Êý¾Ý¿âÖ÷»úµÈÐÅÏ¢ÊÇÎÒÃDZ¾µØµÄ£¬ÒªÊ¹µÃÕâ¸ö²Ù×÷Êý¾ÝµÄÄ£¿é¾ßÓÐͨÓÃÐÔ£¬ÄÇôÒÔÉÏÐÅÏ¢¾Í²»ÄÜдËÀÔÚ³ÌÐòÀͨ³£ÎÒÃǵÄ×ö·¨ÊÇÓÃÅäÖÃÎļþÀ´½â¾ö¡£
¸÷ÖÖÓïÑÔ¶¼ÓÐ×Ô¼ºËùÖ§³ÖµÄÅäÖÃÎļþÀàÐÍ¡£±ÈÈç Python £¬ËûÖ§³Ö .ini Îļþ¡£ÒòΪËûÄÚ²¿ÓÐÒ»¸ö ConfigParser ÀàÀ´Ö§³Ö .ini ÎļþµÄ¶Áд£¬¸ù¾Ý¸ÃÀàÌṩµÄ·½·¨³ÌÐòÔ±¿ÉÒÔ×ÔÓɵÄÀ´²Ù×÷ .ini Îļþ¡£¶øÔÚ Java ÖУ¬ Java Ö§³ÖµÄÊÇ .properties ÎļþµÄ¶Áд¡£ JDK ÄÚÖÃµÄ java.util.Properties ÀàΪÎÒÃDzÙ×÷ .properties ÎļþÌṩÁ˱ãÀû¡£
 
Ò»£® .properties ÎļþµÄÐÎʽ ==========================================================
 
# ÒÔÏÂΪ·þÎñÆ÷¡¢Êý¾Ý¿âÐÅÏ¢
dbPort = localhost
databaseName = mydb
dbUserName = root
dbPassword = root
# ÒÔÏÂΪÊý¾Ý¿â±íÐÅÏ¢
dbTable = mytable
# ÒÔÏÂΪ·þÎñÆ÷ÐÅÏ¢
ip = 192.168.0.9
······
ÔÚÉÏÃæµÄÎļþÖÐÎÒÃǼÙÉè¸ÃÎļþÃûΪ£º test.properties Îļþ¡£ÆäÖÐ # ¿ªÊ¼µÄÒ»ÐÐΪעÊÍÐÅÏ¢£»ÔڵȺœ = ”×ó±ßµÄÎÒÃdzÆ֮Ϊ key £»µÈºÅ“ = ”ÓұߵÄÎÒÃdzÆ֮Ϊ value ¡££¨Æäʵ¾ÍÊÇÎÒÃdz£ËµµÄ¼ü - Öµ¶Ô£© key Ó¦¸ÃÊÇÎÒÃdzÌÐòÖеıäÁ¿¡£¶ø value ÊÇÎÒÃǸù¾Ýʵ¼ÊÇé¿öÅäÖõġ£
 
¶þ£® JDK ÖÐµÄ Properties Àà Properties Àà´æÔÚÓÚ°û Java.util ÖУ¬¸ÃÀà¼Ì³Ð×Ô Hashtable £¬ËüÌṩÁ˼¸¸öÖ÷ÒªµÄ·½·¨£º 1£® getProperty ( String  key) £¬   ÓÃÖ¸¶¨µÄ¼üÔÚ´ËÊôÐÔÁбíÖÐËÑË÷ÊôÐÔ¡£Ò²¾ÍÊÇͨ¹ý²ÎÊý key £¬µÃµ½ key Ëù¶ÔÓ¦µÄ value ¡£
 
2£® load ( InputStream  inStream) £¬´ÓÊäÈëÁ÷ÖжÁÈ¡ÊôÐÔÁÐ±í£¨¼üºÍÔªËضԣ©¡£Í¨¹ý¶ÔÖ¸¶¨µÄÎļþ£¨±ÈÈç˵ÉÏÃæµÄ test.properties Îļþ£©½øÐÐ×°ÔØÀ´»ñÈ¡¸ÃÎļþÖеÄËùÓмü - Öµ¶Ô¡£ÒÔ¹© getProperty ( String  key) À´ËÑË÷¡£ 3£® setProperty ( String  key, String  value) £¬µ÷Óà Hashtable µÄ·½·¨ put ¡£Ëûͨ¹ýµ÷ÓûùÀàµÄput·½·¨À´ÉèÖà ¼ü - Öµ¶Ô¡£
4£® store ( OutputStream  out, String  comments) £¬   ÒÔÊʺÏʹÓà load ·½·¨¼ÓÔص½ Properties ±íÖеĸñʽ£¬½«´Ë Properties ±íÖÐ


Ïà¹ØÎĵµ£º

½âÎöJavaÀàºÍ¶ÔÏóµÄ³õʼ»¯¹ý³Ì

ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......

JavaÓëXMLÁªºÏ±à³ÌÖ®SAXƪ


SAX¸ÅÄî

SAXÊÇSimple API for XML
µÄËõд£¬Ëü²¢²»ÊÇÓÉW3C¹Ù·½ËùÌá³öµÄ±ê×¼£¬¿ÉÒÔ˵ÊÇ“Ãñ¼ä”µÄÊÂʵ±ê×¼¡£Êµ¼ÊÉÏ£¬ËüÊÇÒ»ÖÖÉçÇøÐÔÖʵÄÌÖÂÛ²úÎï¡£ËäÈ»Èç´Ë£¬ÔÚXMLÖжÔSAXµÄÓ¦ÓÃË¿ºÁ²»±ÈDOMÉÙ£¬¼¸ºõËùÓеÄXML½âÎöÆ÷¶¼»áÖ§³ÖËü¡£

Óë
DOM±È½Ï¶øÑÔ£¬SAXÊÇÒ»ÖÖÇáÁ¿Ð͵ķ½·¨¡£ÎÒÃÇÖªµÀ£¬ÔÚ´¦ÀíDOMµÄʱºò£¬Î ......

JAVA IOÁ÷µÄÓ¦ÓÃ

JAVA IOÁ÷µÄÓ¦ÓÃ
 
 
 
IOÁ÷µÄµäÐÍÓ¦ÓÃ
¾¡¹Ü¿âÄÚ´æÔÚ´óÁ¿IOÁ÷À࣬¿Éͨ¹ý¶àÖÖ²»Í¬µÄ·½Ê½×éºÏµ½Ò»Æ𣬵«Êµ¼ÊÉÏÖ»Óм¸ÖÖ·½Ê½²Å»á¾­³£Óõ½¡£È»¶ø£¬±ØÐëСÐÄÔÚÒâ²ÅÄܵõ½ÕýÈ·µÄ×éºÏ¡£ÏÂÃæÕâ¸öÏ൱³¤µÄÀý×ÓչʾÁ˵äÐÍIOÅäÖõĴ´½¨ÓëʹÓ㬿ÉÔÚд×Ô¼ºµÄ´úÂëʱ½«Æä×÷Ϊһ¸ö²Î¿¼Ê¹Óá£×¢Òâÿ¸öÅäÖö¼ÒÔÒ»¸ö×¢ÊÍÐ ......

java ÖÐÓû§·ÃÎÊȨÏÞ£¨spring ȨÏÞ¹ÜÀí£©

// AuthorityInterceptor.java Îļþ
package com.aptech.jb.epet.web.authority;
import javax.servlet.http.HttpServletRequest;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.struts.action.ActionMapping;
public class Authority ......

java ʱ¼ä¸ñʽ»¯

import java.text.SimpleDateFormat;
 Date date=new Date();
  DateFormat  format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  String time=format.format(date);
java.sql.Time now=new java.sql.Time(System.CurrentTimeMillis());
Êä³ö¶ÌµÄϵͳʱ¼ä 18:34:44 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ