易截截图软件、单文件、免安装、纯绿色、仅160KB
热门标签: c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 最新文章 : java

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 ......

Java 文件 Util

 import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import com.paic.is.dispatch.TMPEntry;
public class FileUtil
{
public static File getFileByRelativePath(String relativePath)
{
String absoluteFilePath = ProjectConfig.getApplicationRootPath() +
File.separator + relativePath;
return new File(absoluteFilePath);
}
public static String getInjectedFEFileContent(String relativeFilePath, String fileContent)
{
String FEString = readFEFileContent(relativeFilePath);
return fileContent + "\n" + FEString;
}

public static String readFEFileContent(String relativeFilePath)
{
String absoluteFilePath = ProjectConfig.getApplicationRootPath() +
File.separator + relativeFilePath;

File FEFile = new File(absoluteFilePath);
StringBuffer sb = new StringBuffer();
if(FEFile.exists() && FEFile.canRead() && ......

Java 字符串的 处理

 public class StringUtil
{
public static String convertToStringWithTrim(Object object)
{
if(null == object)
{
return null;
}

String returnStr = (String)object;

return Trim(returnStr);
}
public static String Trim(String str)
{
if(IsEmpty(str))
{
return str;
}

return str.trim();
}
public static boolean IsEmpty(String str)
{
if(null == str || str.length() == 0)
{
return true;
}

return false;
}
/**
* 将字符串包装成XML格式
*/
public static String PackIntoXMLStr(String target)
{
return "<i>" + target + "</i>";
}
/**
* 将字符串包装成XML格式
*/
public static String PackIntoXMLStrWithIndex(String target, String index)
{
return "<v i=\""+index+"\">"+ (target == null ? "": target) + "</v>";
}

public static String bytesToHexString(byte[] src)
{
StringBuilder stringBuilder = new StringBuilder("");
if (src == null || src.l ......

Java 时间范围 Util

 import java.util.Date;
public class TimeSpan
{
public final static TimeSpan ZERO = new TimeSpan(0);

private long _totalMilliSeconds = 0;

public TimeSpan(long totalMilliSeconds)
{
_totalMilliSeconds = totalMilliSeconds;
}

public TimeSpan(Date afterDate, Date beforeDate)
{
this(afterDate.getTime() - beforeDate.getTime());
}

public long getMilliSeconds()
{
return _totalMilliSeconds;
}
public long getSeconds()
{
return Math.round(_totalMilliSeconds/1000);
}
public long getMinutes()
{
return Math.round(_totalMilliSeconds/(1000*60));
}
public long getHours()
{
return Math.round(_totalMilliSeconds/(1000*60*60));
}
}
......

java连接池技术

2009-04-14 15:37
虽然现在用APACHE COMMONS DBCP可以非常方便的建立数据库连接池,
但是像这篇文章把数据库连接池的内部原理写的这么透彻,注视这么完整,
真是非常难得,让开发人员可以更深层次的理解数据库连接池,真是非常感
谢这篇文章的作者。
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Enumeration;
import java.util.Vector;
public class ConnectionPool {
private String jdbcDriver = ""; // 数据库驱动
private String dbUrl = ""; // 数据 URL
private String dbUsername = ""; // 数据库用户名
private String dbPassword = ""; // 数据库用户密码
private String testTable = ""; // 测试连接是否可用的测试表名,默认没有测试表
private int initialConnections = 10; // 连接池的初始大小
private int incrementalConnections = 5;// 连接池自动增加的大小
private int maxConnections = 50; // 连接池最大的大小
private Vector connections = null; // 存放连接池中数据 ......

java 外挂 按键精灵,感兴趣大家一起来学习。

 我在玩一个网页游戏的时候总是按一个键。觉着累。所以就写了一个程序。
Robot r = new Robot();
// 按键
r.keyPress(51);
// 释放
r.keyRelease(51);
用Robot 这个实现自动化的类就可做到。实现这个游戏一直按下这个键子。
也可以做按键精灵类似的软件。但是这个类只能应用当前窗口。怎么能把这个程序固定在某个程序上呢。
让Robot 触发的事件一直挂某个程序上呢。而不让他在当前窗口运行。 ......
总记录数:6386; 总页数:1065; 每页6 条; 首页 上一页 [872] [873] [874] [875] 876 [877] [878] [879] [880] [881]  下一页 尾页
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号