Time of Update: 2018-07-25
司有個業務需要匹配文本中的網址,度娘,穀哥了半天經常看到有對html中擷取超連結的正則,只要匹配<a href=['"]?(.*?)['"]?即可,但如果是普通文本類型的則比較費事些,分享下最後的運算式: import java.util.regex.Matcher;import java.util.regex.Pattern;public class URLMatcher {public static void main(String[] args)
Time of Update: 2018-07-25
1 web 1.1 檔案下載 1.1.1 用戶端 var url = "/services/fileServlet";url += "?beanId=" + beanId;url += "&method=" + method;url += "¶ms=" + $.toJSON(params);var frame =
Time of Update: 2018-07-25
public static void deleteDirFile(String sDirFilePath) { if (sDirFilePath != null && !sDirFilePath.trim().equals("")) { File tDirFile = new File(sDirFilePath); if (tDirFile.exists()) { if (tDirFile.isDirectory()) { File[] arrFiles =
Time of Update: 2018-07-25
我們一般常見的檔案主要有三種形式:文字檔、位元據檔案、混合檔案。作為混合文檔的處理,特別是大型混合文檔的處理,開發人員面臨著特殊的挑戰: 其一,需要對位元據進行定位,並取得位元據內容而進行下一步處理; 其二,要根據位元據的上下文,取得位元據的相關背景資訊,才可能進行下一步處理;
Time of Update: 2018-07-25
1、List中文、字母、數字排序Collections.sort(list);//升序Collections.reverse(list);//倒置成倒序 2、在使用swing開發的時候便於簡便安裝通常使用Access資料庫(office內建),通常也會使用到txt檔案。 3、java寫入txt檔案時換行。windows下的文字檔分行符號:\r\n linux/unix下的文字檔分行符號:\r Mac下的文字檔分行符號:\n
Time of Update: 2018-07-25
下文來自: http://scliu123.iteye.com/blog/506387 -------------------------- package book.number; import java.util.Random; /** * Java工具 + 生產力類庫中的類java.util.Random提供了產生各種類型隨機數的方法。 * 它可以產生int、long、float、double以及Goussian等類型的隨機數。
Time of Update: 2018-07-25
package file;import java.io.File;//刪除指定路徑所有的檔案, 及該檔案夾裡的所有檔案夾,不包括該檔案夾public class fileDel {public static void delAllFiles(File file,String singal){if(!file.exists()){System.out.println("不存在該路徑:
Time of Update: 2018-07-25
找不到基本對象池:“java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool”解決方案 問題: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DataSource' defined in ServletContext resource
Time of Update: 2018-07-25
伺服器端: package nioT;import java.io.IOException;import java.net.InetSocketAddress;import java.nio.ByteBuffer;import java.nio.channels.SelectionKey;import java.nio.channels.Selector;import java.nio.channels.ServerSocketChannel;import
Time of Update: 2018-07-25
常用的有EJB、rmi、Web Service,還有Hessian、NIO等,它們的優缺點比較比下: 1:EJB 優勢:可擴充性好,安全性強,支援分散式交易處理。 劣勢:不能跨語言;配置相對複雜,不同J2EE容器之間很難做無縫遷移。2:rmi 優勢:物件導向的遠程服務模型;基於TCP協議上的服務,執行速度快。
Time of Update: 2018-07-25
原文:http://blog.csdn.net/dc_726/article/details/7944154 1.Class檔案基礎 (1)檔案格式 Class檔案的結構不像XML等描述語言那樣鬆散自由。由於它沒有任何分隔字元號, 所以,以上資料項目無論是順序還是數量都是被嚴格限定的。哪個位元組代表什麼
Time of Update: 2018-07-25
JAVA中,預設支援AES128,如果要使用AES256,還需要替換一下兩個檔案。 Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 下載地址: JDK6 http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html JDK7
Time of Update: 2018-07-25
import java.io.File;import org.tmatesoft.svn.core.SVNException;import org.tmatesoft.svn.core.SVNURL;import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;import
Time of Update: 2018-07-25
/** * 刪除單個檔案 * @param filePath 被刪除檔案的檔案名稱 * @return 檔案刪除成功返回true,否則返回false */ public boolean deleteFile(String filePath) {
Time of Update: 2018-07-25
如代碼所示 /** * */package pkg;import java.util.Enumeration;import java.util.Iterator;import java.util.Map.Entry;import java.util.Properties;/** * @author qefee * */public class ShowProperties {/** * @param args */public static void main(String[]
Time of Update: 2018-07-25
import java.io.Console;import java.io.PrintWriter;public class TestConsole {public static void main(String[] args) {Console cons = System.console();if (cons != null) {// -------------------------PrintWriter printWriter =
Time of Update: 2018-07-25
在使用java來移動檔案時,主要利用IO中的File類,在File類中可以利用renameTo方法實現檔案的移動,執行個體如下: private boolean RemoveFile(String fileName,String destinationFloderUrl) { File file = new File(fileName); File destFloder = new File(destinationFloderUrl);
Time of Update: 2018-07-25
做的程式有時候會需要用到, 記錄下 public class NumberUtil {/** * int整數轉換為4位元組的byte數組 * * @param i * 整數 * @return byte數組 */public static byte[] intToByte4(int i) {byte[] targets = new byte[4];targets[3] = (byte) (i & 0xFF);targets[2] = (byte) (
Time of Update: 2018-07-25
java finalize 方法引發的記憶體泄露 Posted: Mon, 11 Mar 2013 java 記憶體dump 記憶體dump後,大量的記憶體(>5G) 被 java.lang.ref.Finalizer hold 住(見圖1)。 而這些記憶體是BDB佔用,懷疑是BDB有記憶體泄露(見圖2)。 java finalizer 機制 為什麼會是
Time of Update: 2018-07-25
我在公司寫的一個隨機數的工具類,比較實用。 它可以指定字母或數字產生多少位隨機數。 package com.hanyastar.util.o;import java.util.Random;/** * <b>隨機類工具</b> * * @author Belen * @version 1.0 * @since 2013-5-16 */ public abstract