易截截图软件、单文件、免安装、纯绿色、仅160KB

Java常用代码

     /**
     * 创建一个新的文件
     * @param relativePath 相对路径
     * @param fileName 文件名
     * @return
     * @throws IOException
     */
    public File createFile(String relativePath, String fileName) throws IOException {
        String upPath = getFileUploadPath() + relativePath + "\\";
        System.out.println("upPath:" + upPath);/////////////////////////////
        System.out.println("fileName:" + fileName);/////////////////////////////
        String nameWithoutExt = getNameWithoutExtension(fileName);
        String ext = getExtension(fileName);
        createDirectory(upPath);// 上传目录不存在则创建目录
        File newFile = new File(upPath + fileName);
        // 若有重名文件则修改名称创建新的文件
        for (int counter = 1; newFile.exists(); counter ++) {
            fileName = nameWithoutExt + "(" + String.valueOf(counter) + ")." + ext;
            newFile = new File(upPath + fileName);
        }
        newFile.createNewFile();
        return newFile;
    }
=================================================================================
    /**
    * 文件的写入 (单行写入)
    * @param filePath(文件路径)
    * @param fileName(文件名)
    * @param args
    * @throws IOException
    */
    public void writeF


相关文档:

java 关键字

 Java关键字(keywords)
abstract    default    if            private      this
boolean     do         implements &nbs ......

java 导出excel方法

到http://download.csdn.net/source/1781433下载jxl.jar文件
/*Title是保存出来的文件名,gbl_LastOpenPath用于记录上次打开的路径*/
public void ExportToExcel(JTable table, String Title){
File DefaultFile;
JFileChooser fc = new JFileChooser();
File file;
if(gbl_LastOpen ......

Java LDAP用户密码验证

到http://download.csdn.net/source/1781441下载JLDAP.jar文件
验证代码段如下:
DirContext ctx = null;
String account = "aa"; //用户名
   String password = "123"; //登录密码
String root = "dc=scut,dc=edu,dc=cn"; // root
Hashtable env = new Hashtable() ......

Java中加密算法的应用二:MD5

public static String getMD5(byte[] source) {
String s = null;
char hexDigits[] = { // 用来将字节转换成 16 进制表示的字符
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
try
{
java. ......

java内部类总结

 
          
定义在一个类内部的类叫内部类,包含内部类的类称为外部类。内部类可以声明public、protected、private等访问限制,可以声明为
abstract的供其他内部类或外部类继承与扩展,或者声明为static、final的,也可以实现特定的接口。static的内部类行为上象一 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号