java非递归检索文件夹下所有文件DateFormat df = DateFormat.getDateTimeInstance();LinkedList<File> folders = new LinkedList<File>();LinkedList<File> filelists = new LinkedLi……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2537浏览 152个赞
Java对json是否合法进行格式校验/** * 用于校验一个字符串是否是合法的JSON格式 * */import java.text.CharacterIterator;import java.text.StringCharacterIterator;public class JsonValidator { private Ch……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2473浏览 1862个赞
java对properties文件进行解析,在用java自带的properties类进行properties文件解析的时候,输出的时候很可能出现乱码问题,在开始的时候我也是找不到问题,查出了之后,贴出来跟大家分享。作者:xulong1516519package properties;import java.io.File;import java.i……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3219浏览 761个赞
Java DOC 转换给 PDF 格式文档import java.io.File;import java.net.ConnectException;import java.util.Date;import com.artofsolving.jodconverter.DocumentConverter;import com.artofsolvin……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1938浏览 1928个赞
可以用于有向图和无向图。用负数表示该有向路不通。在EditPlus上写的,所以就一个.java文件。package Test;import java.util.TreeMap;import java.util.ArrayList;import java.io.BufferedReader;import java.io.InputStreamRe……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1841浏览 1206个赞
Java读写二进制文件import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; impor……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2031浏览 443个赞
Java查找目录下的及子目录下的指定扩展名的文件package FileDemo;import java.io.BufferedWriter;import java.io.File;import java.io.FileWriter;import java.io.FilenameFilter;import java.io.IOExceptio……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1854浏览 2163个赞
java操作XML中的占位符 有时XML的某些内容是待定的,对于这些内容可以在XML文件中使用占位符<people> <person id="001"> <name>$name</name> ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1978浏览 1897个赞
java在web端直接输出Excel实现下载public String excelDomnload() throws Exception{ try{ /* String path = GlobalKeys.getFunctionConfig("user_attach_save","/opt/tmp/&qu……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2538浏览 1970个赞
Java实现的字符型进度条package com.gondi.util;/** * 显示进度条(参数:当前点、结束点、进度条长度) * example: * System.out.println(ProgressBar.showBarByPoint(30, 100, 20)); * result: * [-----> ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2505浏览 2512个赞
Java读取Html文本解析email地址的代码代码来自:http://blog.csdn.net/javaalpha/article/details/8332587package com.alpha.test;import java.io.BufferedReader;import java.io.File;import java.io.File……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2143浏览 246个赞
Java获取系统当前时间的方法并指定格式/** * 返回当前日期时间字符串<br> * 默认格式:yyyy-mm-dd hh:mm:ss * * @return String 返回当前字符串型日期时间 */ public static String getCurrentTime() { String return……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1649浏览 1899个赞
创建ZIP和JAR文件import java.util.zip.*;import java.io.*;public class ZipIt {public static void main(String args[]) throws IOException {if (args.length < 2) {System.err.prin……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3277浏览 365个赞
java发送邮件import javax.mail.*;import javax.mail.internet.*;import java.util.*;public void postMail( String recipients[ ], String subject, String message , String from) throws……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3374浏览 2897个赞
发送代数据的HTTP 请求import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URL;public class Main {public static void main(String[] args) {try {URL my_ur……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2837浏览 1170个赞
把 Array 转换成 Mapimport java.util.Map;import org.apache.commons.lang.ArrayUtils;public class Main {public static void main(String[] args) {String[ ][ ] countries = { { &quo……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1462浏览 2476个赞
Java正则表达式提取 Email 地址import java.util.regex.Matcher;import java.util.regex.Pattern;import java.io.BufferedReader;import java.io.File;import java.io.FileReader;import java.io……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2020浏览 2702个赞
Java中,通常有两种遍历HashMap的方法,大家可以参考一下:转自:http://blog.csdn.net/newcnzz/article/details/8434631import java.util.*; public class MapTest { static HashMap<String, Integer> ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2331浏览 963个赞
Java中创建与启动线程(Threading)的代码演示转自:http://java.chinaitlab.com/line/373702.htmlpublic class MyThread_1 extends Thread{public void run(){//some code }} ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2371浏览 1170个赞
Java实现简单的鼠标划线import javax.swing.JFrame;import javax.swing.JPanel;import java.awt.Graphics;import java.awt.event.MouseListener;import java.awt.event.MouseMotionListener;impo……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1743浏览 1870个赞
java实现的二分查找法static public int search(int [] array, int target){ int high = array.length, low = -1, probe; while (high - low > 1) { probe = (low + high) &……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2387浏览 904个赞
java代码将时间从sourceTZ时区转换成targetTZ时区/* * Converts time from sourceTZ TimeZone to destTZ TimeZone. * * @return converted time, or the original time, in case the datetime c……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1686浏览 706个赞
Java运行时获得参数类型class A<T> { Class<T> specializedClass; public A() { this.specializedClass = (Class<T>) ((ParameterizedType) this.getClass() ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1901浏览 1962个赞
Java创建二叉树并遍历的代码来源:http://blog.csdn.net/yhhazr/article/details/7944089public class BinaryTree { private Node root; /** * * 内部节点类 * @author yhh */ private class Node……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1844浏览 636个赞
解析class的工具类package com.google.reflect;import java.lang.reflect.Field;import java.lang.reflect.Method;import java.lang.reflect.Modifier;import java.lang.reflect.Proxy;impo……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2602浏览 1068个赞
java 文件夹操作import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.ni……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2007浏览 2026个赞
java生成pdf package com.hundsun.gildata.irp.core.action;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import com.hundsun.gildata.irp.common.……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3174浏览 1887个赞
Java模拟队列的出队和进队 package com.stackANDqueue;import java.io.DataInputStream;import java.io.IOException;/* * 循环队列的入队和出队 */public class Queue { static int MAX = 20; static ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1894浏览 2563个赞
—–初试阿里云平台——目录—–初试阿里云平台——一、什么是阿里云平台与阿里云Serverless技术二、日常部署三、个人心得一、什么是阿里云平台与阿里云Serverless技术云开发平台是面向开发者打造的一站式、全云端的开发平台,打开浏览器就可以开发、调试、上线,……继续阅读 » Thomas_one 5年前 (2021-04-07) 1946浏览 0评论458个赞
JS代码时间格式与时间戳的相互转换 一.时间转换时间戳function transdate(endTime){var date=new Date();date.setFullYear(endTime.substring(0,4));date.setMonth(endTime……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1955浏览 2713个赞
JavaScript添加到收藏夹和设置为主页的代码,网站上经常用到的两个功能// JavaScript Document// 加入收藏 < a onclick="AddFavorite(window.location,document.title)" >加入收藏< /a>function AddFav……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2673浏览 1484个赞
JavaScript SHA512加密算法详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-512, as defined * in FIPS 180-2 * Version 2.2 Copyright Anonymous Contributor, Pau……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3403浏览 660个赞
JavaScript SHA-256加密算法详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined * in FIPS 180-2 * Version 2.2 Copyright Angel Marin, Paul Johnsto……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2821浏览 1731个赞
JavaScript SHA1加密算法实现详细代码/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS 180-1 * Version 2.2 Copyright Paul Johnston 2000 - 2009. ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2461浏览 599个赞
当鼠标在图片上方时,图片停止漂浮,点击关闭按钮可隐藏图片,代码简单,直接插入网页更换成自己的漂浮图片就可以使用。<body><div id="float" style=" position:absolute; z-index:3"><img id="img1"……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1905浏览 2247个赞
JavaScript检测浏览器cookie是否已经启动,代码稍显复杂,通过写入一个测试cookie判断cookie是否已经启动var dt = new Date(); dt.setSeconds(dt.getSeconds() + 60); document.cookie = "cookietest=1; expires=" +……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3152浏览 288个赞
在一个网页中同时调用jQuery和prototype会产生冲突,主要是$全局变量冲突,下面这段代码有效的解决了这个问题一定要先引入prototype.js 再引入jquery.js,先后顺序不可错<script src="prototype.js"></script><script src=&quo……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1753浏览 300个赞
要从列表框同时删除多个项目,我们不能从上到下的删除,因为上面的项目每删除一个,下面的项目的索引号就会变化,所以只能从下向上删除,这样就不会出现索引号乱变的问题了。 html代码<table><tr> <td align="cent……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1983浏览 2644个赞
JavaScript里字符串不能直接换行书写,需要使用 \ 符号进行换行,其实这一点非常不方便,不过目前也没有好的办法。var multiStr = "This is the first line \ This is the second line \ This is more... \ http://www.75271.com ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3446浏览 2994个赞
这段代码演示了jQuery通过closest选择器上一级的元素,然后修改其text()内容<!DOCTYPE html><html><head> <meta http-equiv="content-type" content="text/html; charset=UTF……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3293浏览 2497个赞
如果jquery要选择的元素id中带有点符号,在选择时需要在点前面加上两个反斜杠,如:$(“#address\\.street”).text(“Enter this field”);<!DOCTYPE html><html><head> <meta h……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2827浏览 704个赞
jQuery克隆JavaScript对象,下面的代码演示了如何克隆jQuery的对象,也演示了如何克隆JavaScript的对象 jquery中克隆对象可以用// Clone the DIVvar cloned = $('#somediv').clone()……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2358浏览 2738个赞
JavaScript给url网址进行encode编码,使用encodeURIComponent即可var myUrl = 'http://www.baidu.com';var myOtherUrl = "http://www.75271.com/index.html?url=" + encode……继续阅读 » 水墨上仙 5年前 (2021-04-07) 1685浏览 398个赞
这段JS代码用于从数组中移除重复的元素,比如: [‘apple’, ‘orange’, ‘peach’, ‘apple’, ‘strawberry’, ‘orange’] 去重后返回:s [‘apple&……继续阅读 » 水墨上仙 5年前 (2021-04-07) 3279浏览 816个赞
下面的JS代码,为String对象定义了一个contains方法用于判断字符串是否包含子字符串,非常有用。if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(obj, start) { for (var i = (start || 0), j ……继续阅读 » 水墨上仙 5年前 (2021-04-07) 2007浏览 306个赞