Java Òì³£´¦Àí
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
public class ExceptionDefaultHandler
{
private final static String _relativeExceptionLogPath = "log";
private final static String _defaultExceptionLogFileName = "exception.log";
// private static boolean hasFile = false;
private static void generateDefaultLogFile()
{
String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + _relativeExceptionLogPath + File.separator +
_defaultExceptionLogFileName;
File file = new File(absoluteFilePath);
if(!file.exists())
{
try
{
file.createNewFile();
}
catch(IOException EX)
{
System.out.println(EX.toString());
}
}
}
private static void generateLogFile(String fileName)
{
String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + _relativeExceptionLogPath + File.separator + fileName;
File file = new File(absoluteFilePath);
if(!file.exists())
{
try
{
file.createNewFile();
}
catch(IOException ex)
{
System.out.println(ex.toString());
}
}
}
public static void handle(Exception ex, String fileName)
{
generateLogFile(fileName);
String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + _relativeExceptionLogPath+ File.separator + fileName;
File file = new File(absoluteFilePath);
if(file.canWrite())
{
boolean appendFlag = true;
if(file.length() > 1000000)
{
appendFlag = false;
}
PrintWriter streamWriter = null;
try
{
streamWriter = new PrintWriter(new FileOutputStream(file, appendFlag));
streamWriter.write("----------------------------------------------------------------");
streamWriter.write(DateTimeUtil.getCurrentDateLocalFormatString());
streamWriter.write("---------------------------------------------------
Ïà¹ØÎĵµ£º
µÚÒ»½Ú Êý¾ÝÁ÷µÄ»ù±¾¸ÅÄî
Àí½âÊý¾ÝÁ÷
Á÷Ò»°ã·ÖΪÊäÈëÁ÷£¨Input Stream£©ºÍÊä³öÁ÷£¨Output Stream£©Á½À࣬µ«ÕâÖÖ»®·Ö²¢²»ÊǾø¶ÔµÄ¡£±ÈÈçÒ»¸öÎļþ£¬µ±ÏòÆäÖÐдÊý¾Ýʱ£¬Ëü¾ÍÊÇÒ»¸öÊä³öÁ÷£»µ±´ÓÆäÖжÁÈ¡Êý¾Ýʱ£¬Ëü¾ÍÊÇÒ»¸öÊäÈëÁ÷¡£µ±È»£¬¼üÅÌÖ»ÊÇÒ»¸öÊýÈËÁ÷£¬¶øÆÁÄ»ÔòÖ»ÊÇÒ»¸öÊä³öÁ÷¡£ ......
Java ¿ª·¢ÎªÊ²Ã´ÐèÒª UML
¡¡¡¡ÖªµÀ UML Ôì³ÉÁËÔõÑùµÄ¾ÖÃæ´ó»ìÂÒÂð£¿ÖªµÀʲôÑùµÄ¹¦ÄÜÊÇ UML ÓµÓе« JAVA ²»¾ß±¸µÄÂð£¿ÖªµÀÎÒÃÇΪʲôÐèÒª³ý JAVA ÍâµÄÁíÒ»ÖÖµçÄÔÓïÑÔÂð£¿UML ²¢²»½ö½öÖ»ÊÇ JAVA »òÕßÆäËüʲôÓïÑÔµÄÌæ´úÆ·¡£UML ÊÇÃæÏò¶ÔÏóµÄ·ÖÎö¼°Éè¼ÆµÄ×¢ÊÍ¡£UML ÊǶÀÁ¢ÓÚÄÇЩ´«Í³Éè¼ÆÓïÑÔÖ®ÍâµÄÒ»ÖÖÓïÑÔ¡£ÒòΪ UML ......
2009-04-14 16:39
½üˮ¥̨ÏȵÃÔ£¬ÏòÑô»¨Ä¾Ò×Ϊ´º--------ËÕ÷ë
»º´æµÄ×÷ÓÃÔÚµÚÒ»ÂÛhttp://hi.baidu.com/%CB%BC%C3%F4%D3%EA/blog/item/908d0cdecbc8a71b495403cc.htmlÖÐÒÑÓв¿·Ö²ûÊö,ÏÂÃæahuaxuanºÍ´ó¼ÒÒ»ÆðÀ´Ñ§Ï°Ò»Ï»º´æµÃÁíÍâÒ»¸öÖØÒªµÄ¹æÔò,½üºÍ¿ì.
ÔÚÎÒÃÇ´ò¿ªä¯ÀÀÆ÷,¾ö¶¨ä¯ÀÀij¸öÍøҳ֮ǰ(Ö¸ÈËÑÛ¿´µ½ÆÁÄ»ÉϵÄÄÚÈ ......
package server;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Recta ......
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
public class DocumentUtil
{
public static Document loadXMLByAbsolutePath(String absoluteFilePath, String logFileName)
{
SAXReader saxReader = new SAXReader();
Document document = null;
try ......