Java Ïß³ÌÖмǼÈÕÖ¾
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
public class ThreadLog
{
private final static String _detailLogFile = "log"+File.separator+"detail";
private static boolean _logFlag = true;
private static HashMap<String, String> _threadDetailFile = new HashMap<String, String>();
private static int _fileIndex = 1;
private static void generateLogFile(String fileName)
{
String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + "log" + File.separator +fileName;
_threadDetailFile.put(String.valueOf(Thread.currentThread().getId()) + "_" + fileName,
absoluteFilePath);
File file = new File(absoluteFilePath);
//create a new file
if(!file.exists())
{
try
{
file.createNewFile();
}
catch(IOException ex)
{
ExceptionDefaultHandler.handle(ex, "threadlog.log");
}
}
}
private static void generateLogFile()
{
String fileName = _detailLogFile +
DateTimeUtil.getCurrentDateFormatString("yyyyMMddHHmmss") +"_"+
String.valueOf(_fileIndex++)+ ".log";
String absoluteFilePath = ProjectConfig.getNFSCAbsolutePath() +
File.separator + fileName;
_threadDetailFile.put(String.valueOf(Thread.currentThread().getId()), absoluteFilePath);
File file = new File(absoluteFilePath);
//if the file exist, we have to remove it.
if(file.exists())
{
try
{
file.delete();
}
catch(SecurityException ex)
{
ExceptionDefaultHandler.handle(ex, "threadlog.log");
}
}
//create a new file
try
{
file.createNewFile();
}
catch(IOException ex)
{
ExceptionDefaultHandler.handle(ex, "threadlog.log");
}
}
private static boolean hasThreadLogFile()
{
return _threadDetailFile.containsKey(String.valueOf(Thread.currentThread().getId()));
}
private static boolean hasThreadLogFi
Ïà¹ØÎĵµ£º
// ´´½¨Excel
String destFileName = tableName + ".xls";//ÎļþÃû
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment; filename=".concat(String .valueOf(destFileNa ......
Java ¶¨ÒåµÄλÔËË㣨bitwise operators £©Ö±½Ó¶ÔÕûÊýÀàÐ͵Äλ½øÐвÙ×÷£¬ÕâЩÕûÊýÀàÐͰüÀ¨long£¬int£¬short£¬char£¬and byte ¡£±í4-2 ÁгöÁËλÔËË㣺
±í4.2 λÔËËã·û¼°Æä½á¹û
ÔËËã·û &nb ......
µÚÒ»½Ú Êý¾ÝÁ÷µÄ»ù±¾¸ÅÄî
Àí½âÊý¾ÝÁ÷
Á÷Ò»°ã·ÖΪÊäÈëÁ÷£¨Input Stream£©ºÍÊä³öÁ÷£¨Output Stream£©Á½À࣬µ«ÕâÖÖ»®·Ö²¢²»ÊǾø¶ÔµÄ¡£±ÈÈçÒ»¸öÎļþ£¬µ±ÏòÆäÖÐдÊý¾Ýʱ£¬Ëü¾ÍÊÇÒ»¸öÊä³öÁ÷£»µ±´ÓÆäÖжÁÈ¡Êý¾Ýʱ£¬Ëü¾ÍÊÇÒ»¸öÊäÈëÁ÷¡£µ±È»£¬¼üÅÌÖ»ÊÇÒ»¸öÊýÈËÁ÷£¬¶øÆÁÄ»ÔòÖ»ÊÇÒ»¸öÊä³öÁ÷¡£ ......
2009-04-14 16:39
½üˮ¥̨ÏȵÃÔ£¬ÏòÑô»¨Ä¾Ò×Ϊ´º--------ËÕ÷ë
»º´æµÄ×÷ÓÃÔÚµÚÒ»ÂÛhttp://hi.baidu.com/%CB%BC%C3%F4%D3%EA/blog/item/908d0cdecbc8a71b495403cc.htmlÖÐÒÑÓв¿·Ö²ûÊö,ÏÂÃæahuaxuanºÍ´ó¼ÒÒ»ÆðÀ´Ñ§Ï°Ò»Ï»º´æµÃÁíÍâÒ»¸öÖØÒªµÄ¹æÔò,½üºÍ¿ì.
ÔÚÎÒÃÇ´ò¿ªä¯ÀÀÆ÷,¾ö¶¨ä¯ÀÀij¸öÍøÒ³Ö®Ç°(Ö¸ÈËÑÛ¿´µ½ÆÁÄ»ÉϵÄÄÚÈ ......
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Properties;
public class SystemProperties
{
public static String LINE_SEPARATOR = "line.separator";
public static String FILE_SEPARATOR = "file.separator";
public static String USER_LANGUAGE = "user.language";
......