【Java基礎】Java開發過程中的常用工具類庫

来源:https://www.cnblogs.com/54chensongxia/archive/2019/10/16/11688868.html
-Advertisement-
Play Games

Java開發過程中的常用工具類庫 [TOC] Apache Commons類庫 Apache Commons是一個非常有用的工具包,為解決各種實際的問題提供了通用現成的代碼,不需要我們程式員再重覆造輪子。關於這個類庫的詳細介紹可以訪問 "官網介紹" 。下麵表格列出了部分的工具包。我們平時開發過程中可 ...


目錄

Java開發過程中的常用工具類庫



Apache Commons類庫

Apache Commons是一個非常有用的工具包,為解決各種實際的問題提供了通用現成的代碼,不需要我們程式員再重覆造輪子。關於這個類庫的詳細介紹可以訪問官網介紹。下麵表格列出了部分的工具包。我們平時開發過程中可以根據自己的需要挑選合適的工具包。

Components Description Latest Version Released
BCEL Byte Code Engineering Library - analyze, create, and manipulate Java class files 6.3.1 2019/3/24
BeanUtils Easy-to-use wrappers around the Java reflection and introspection APIs. 1.9.3 2016/9/26
BSF Bean Scripting Framework - interface to scripting languages, including JSR-223 3.1 2010/6/24
Chain Chain of Responsibility pattern implemention. 1.2 2008/6/2
CLI Command Line arguments parser. 1.4 2017/3/9
Codec General encoding/decoding algorithms (for example phonetic, base64, URL). 1.12 2019/2/16
Collections Extends or augments the Java Collections Framework. 4.3 2019/2/5
Compress Defines an API for working with tar, zip and bzip2 files. 1.18 2018/8/16
Configuration Reading of configuration/preferences files in various formats. 2.4 2018/10/29
Crypto A cryptographic library optimized with AES-NI wrapping Openssl or JCE algorithm implementations. 1.0.0 2016/7/22
CSV Component for reading and writing comma separated value files. 1.6 2018/9/25
Daemon Alternative invocation mechanism for unix-daemon-like java code. 1.0.15 2013/4/3
DBCP Database connection pooling services. 2.6.0 2019/2/19
DbUtils JDBC helper library. 1.7 2017/7/20
Digester XML-to-Java-object mapping utility. 3.2 2011/12/13
Email Library for sending e-mail from Java. 1.5 2017/8/1
Exec API for dealing with external process execution and environment management in Java. 1.3 2014/11/6
FileUpload File upload capability for your servlets and web applications. 1.4 2019/1/16
Functor A functor is a function that can be manipulated as an object, or an object representing a single, generic function. 1 2011-??-??
Geometry Space and coordinates. 1 2018-??-??
Imaging (previously called Sanselan) A pure-Java image library. 0.97-incubator 2009/2/20
IO Collection of I/O utilities. 2.6 2017/10/15
JCI Java Compiler Interface 1.1 2013/10/14
JCS Java Caching System 2.2,1 2018/8/23
Jelly XML based scripting and processing engine. 1.0.1 2017/9/27
Jexl Expression language which extends the Expression Language of the JSTL. 3.1 2017/4/14
JXPath Utilities for manipulating Java Beans using the XPath syntax. 1.3 2008/8/14
Lang Provides extra functionality for classes in java.lang. 3.9 2019/4/15
Logging Wrapper around a variety of logging API implementations. 1.2 2014/7/11
Math Lightweight, self-contained mathematics and statistics components. 3.5 2015/4/17
Net Collection of network utilities and protocol implementations. 3.6 2017/2/15
Numbers Number types (complex, quaternion, fraction) and utilities (arrays, combinatorics). 1 2017-??-??
OGNL An Object-Graph Navigation Language 4 2013-??-??
Pool Generic object pooling component. 2.6.2 2019/4/11
Proxy Library for creating dynamic proxies. 1 2008/2/28
RDF Common implementation of RDF 1.1 that could be implemented by systems on the JVM. 0.3.0-incubating 2016/11/15
RNG Implementations of random numbers generators. 1.2 2018/12/12
SCXML An implementation of the State Chart XML specification aimed at creating and maintaining a Java SCXML engine.It is capable of executing a state machine defined using a SCXML document, and abstracts out the environment interfaces. 0.9 2008/12/1
Statistics Statistics. 0.1 ????-??-??
Text Apache Commons Text is a library focused on algorithms working on strings. 1.6 2018/10/16
Validator Framework to define validators and validation rules in an xml file. 1.6 2017/2/21
VFS Virtual File System component for treating files, FTP, SMB, ZIP and such like as a single logical file system. 2.3 2019/2/4
Weaver Provides an easy way to enhance (weave) compiled bytecode. 2 2018/9/7

除了上面表格中的工具包,Apache Common項目還包括以下幾個工具包,其中的http-client是我們平時非常常用的。

  • Cactus: Cactus is a simple test framework for unit testing server-side java code (Servlets, EJBs, Tag Libs, Filters, ...). The intent of Cactus is to lower the cost of writing tests for server-side code.
  • HiveMind: HiveMind is a services and configuration microkernel. HiveMind allows you to create your application using a service oriented architecture.
  • HttpClient 3.x: Framework for working with the client-side of the HTTP protocol.
  • Naming: The Naming subproject will contain common JNDI code along with various JNDI providers.

Guava類庫

Guava工程包含了若幹被Google的 Java項目廣泛依賴 的核心庫,例如:集合 [collections] 、緩存 [caching] 、原生類型支持 [primitives support] 、併發庫 [concurrency libraries] 、通用註解 [common annotations] 、字元串處理 [string processing] 、I/O 等等。下麵列出Guava工具包中的常用功能點,以便需要的時候查閱使用。

基本工具 [Basic utilities]

集合[Collections]

Guava對JDK集合的擴展,這是Guava最成熟和為人所知的部分

  • 不可變集合: 用不變的集合進行防禦性編程和性能提升。
  • 新集合類型: multisets, multimaps, tables, bidirectional maps等。
  • 強大的集合工具類: 提供java.util.Collections中沒有的集合工具。
  • 擴展工具類:讓實現和擴展集合類變得更容易,比如創建Collection的裝飾器,或實現迭代器。

緩存[Caches]

Guava Cache:本地緩存實現,支持多種緩存過期策略。

函數式風格[Functional idioms]

Guava的函數式支持可以顯著簡化代碼,但請謹慎使用它。

併發[Concurrency]

強大而簡單的抽象,讓編寫正確的併發代碼更簡單

字元串處理[Strings]

非常有用的字元串工具,包括分割、連接、填充等操作

原生類型[Primitives]

擴展 JDK 未提供的原生類型(如int、char)操作, 包括某些類型的無符號形式

區間[Ranges]

可比較類型的區間API,包括連續和離散類型

I/O

簡化I/O尤其是I/O流和文件的操作,針對Java5和6版本

散列[Hash]

提供比Object.hashCode()更複雜的散列實現,並提供布魯姆過濾器的實現

事件匯流排[EventBus]

發佈-訂閱模式的組件通信,但組件不需要顯式地註冊到其他組件中

數學運算[Math]

優化的、充分測試的數學工具類

反射[Reflection]

Guava 的 Java 反射機制工具類

Spring中的常用工具類

  • FileCopyUtils;
  • WebUtil;

參考下麵博客:
https://www.cnblogs.com/davidwang456/p/4106519.html
https://www.jb51.net/article/125424.htm

其他工具

後續逐漸添加~

參考

  • 併發編程網Guava教程
  • Apache Common官網

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 近日在YouTube視頻上看到關於vector中emplace_back與push_back區別的介紹,深感自己在現代C++中還是有不少遺漏的知識點,遂寫了段代碼,嘗試比較兩者的差別。 示例代碼 運行結果 結論 emplace_back方法可以不調用拷貝構造函數,所以理論上它應該比push_back ...
  • 在 "上篇文章" 中,我們簡單介紹了EurekaServer自動裝配及啟動流程解析,本篇文章則繼續研究EurekaClient的相關代碼 老規矩,先看 文件,其中引入了一個配置類 上方兩個註解則是這個配置類是否能夠開啟的條件,這裡就不再展開,直接看它引入的配置類吧 1. 細心的讀者可能會發現這裡又註 ...
  • import xlrdimport matplotlib.pyplot as plt bok = xlrd.open_workbook(r'test.xls') sht = bok.sheets()[0] row1 = sht.row_values(0) X=sht.col_values(0 , s ...
  • 使用Thymeleaf的屬性來設置HTML屬性。 (1)使用th:attr屬性可以修改原來HTML節點的屬性; (2)th:attr屬性可以同時設置多個屬性; (3)每一個HTML屬性都有對應的Thymeleaf屬性,如th:attr="value='值'"可換為th:value="值" (... ...
  • pycharm中.py文件模板應用方法: 設置->文件和代碼模板->文件->Python Script->右側輸入模板內容->應用->確定註釋: #開頭為單行註釋(快捷鍵為CTRL+/),成對的'''中間的為多行註釋多行代碼連接符:\ print("hello world") 等於print("he ...
  • 1. 統計字元(可以在jieba分詞之後使用) 2. 多次覆蓋,迴圈寫入文件 比如,迴圈兩次的結果是: 3. 一次性寫入文件,中間不會覆蓋和多次寫入;但是如果重覆運行代碼,則會覆蓋之前的全部內容,一次性重新寫入所有新內容 ...
  • IntelliJ快捷鍵 導入包 alt + enter 刪除游標所在行 ctrl + y 複製游標所在行 ctrl + d 格式代碼 ctrl + alt + l 單行註釋 ctrl + / 多行註釋 ctrl + shift + / 自動生成代碼 alt + ins 移動代碼 alt + shif ...
  • "Python3 多進程編程(Multiprocess programming)" "為什麼使用多進程" "具體用法" "Python多線程的通信" "進程對列Queue" "生產者消費者問題" "JoinableQueue" "Queue實例" "管道Pipe" Python3 多進程編程(Mul ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...