随笔分类 - JAVA
摘要:// 删除文件夹下的所有文件 public static boolean delAllFile(String path) { boolean flag = false; File file = new File(path); if (!file.exists()) { return flag; } if (!file.isDirectory()) { retu...
阅读全文
摘要:public static void main(String[] args) { String[] sym = new String[]{"+", "-", ""}; String[] nums = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9"}; int count = 0; int le
阅读全文
摘要://获取链接 URL url = new URL("http://api.map.baidu.com/telematics/v3/weather?location=guangzhou&output=JSON&ak=XXX"); //打开链接 URLConnection conn = url.openConnection(); //设置访问超时 conn.setConnectTimeout(100...
阅读全文
摘要://创建链接 URL url = new URL("http://api.map.baidu.com/images/weather/day/xiaoyu.png"); //打开链接 URLConnection conn = url.openConnection(); conn.setConnectTimeout(1000); InputStream is = conn.getInputStre...
阅读全文
摘要://获取工程classes下的路径 this.getClass().getClassLoader().getResource("").getPath(); //获取当前线程的一个目录路径 String classpath = Thread.currentThread().getContextClassLoader().getResource("").toString(); //截取路径 拼装...
阅读全文
摘要:服务器端推送技术 新邮件推送 网页聊天 微信签到墙 什么是BS、什么是CS、什么是pull、什么是push 客户端得到通知的方式? 定时刷新 Ajax轮训 Comet长连接(长期占用长连接资源) Flash XML Socket(需要JS结合Flash接口) Java Applet套接口(需要在客户
阅读全文
摘要:// 发送post请求 public static String sendPost(String url, String param) { PrintWriter out = null; BufferedReader in = null; String result = ""; try { ...
阅读全文
摘要:1 //带有特殊符号字符串示例 2 String str = "我的名字(测试)"; 3 4 //去除特殊字符内容 其中的“()”为特殊字符 5 str.replaceAll("[^0-9a-zA-Z\u4e00-\u9fa5.,,。?“”]+",""); 6 7 //去除特殊符号后字符串内容: 8 System.out.println("字符串str:" + str");// str:我的...
阅读全文

浙公网安备 33010602011771号