Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used class libraries and API in Java development

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you the "commonly used class libraries and API in Java development", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "what are common class libraries and API in Java development" this article.

First, log related

Printing logs is the most important thing in server-side applications, because logs are the only way for you to know what happened to your program. Although JDK comes with its own log library, there are many better options available, such as Log4j, SLF4j, and LogBack.

2. JSON analysis library

In today's web services and the Internet of things (IoT), JSON has replaced XML as the preferred protocol for transmitting information from client to server. Although JDK does not provide the JSON library. But there are many excellent third-party libraries that can be used to parse and create JSON messages, such as Jackson and Gson

Third, unit test library

The use of unit testing technology is an important indicator to distinguish an ordinary developer from a good developer. Programmers often have a variety of excuses not to write unit tests, but the most common excuse is lack of experience and knowledge. Common single test frameworks are JUnit, Mockito and PowerMock.

IV. General class library

There are several good third-party common libraries available to Java developers, such as Apache Commons and Google Guava. Because these general class libraries have been practiced by countless developers, they are the best in terms of practicality and performance.

5. Http library

JDK lacks support for HTTP. Although you can use java.net package classes, this is much more troublesome than directly using open source libraries such as Apache HttpClient and HttpCore.

VI. XML analysis library

There are many XML parsing libraries on the market, such as Xerces, JAXB, JAXP, Dom4j, Xstream and so on. Xerces2 is the next generation of high-performance, fully compatible XML parsing tools. Xerces2 defines the Xerces Native Interface (XNI) specification and provides a complete, standards-compliant implementation of the XNI specification. The parser is completely redesigned and implemented, simpler and modular.

7. Excel read-write library

Many applications need to provide the ability to export data to Excel, and if you want to do the same Java application, you need Apache POI API. This is a very rich class library, you can read and write XLS files from Java programs.

8. Byte code library

If you are writing a framework or class library. There are popular bytecode libraries such as javassist and Cglib Nodep that allow you to read and modify the bytecode generated by the application. Javassist makes JAVA bytecode operation very simple. It is a class library for editing Java bytecode. ASM is another useful bytecode editing library.

Database connection pool library

If your Java application does not interact with the database using the database connection pool library, then you are making a big mistake. Because creating a database connection at run time is time-consuming and slows down your program. So it is strongly recommended that there are some useful connection pooling to choose from, such as Commons Pool and DBCP. In web applications, web servers typically provide these capabilities. However, in the java project, the class library of database connection pool needs to be imported into the application.

Message passing Library

Like logging and database connection pooling, messaging is a must in many real-world Java projects. Java provides JMS Java messaging service, but this is not part of JDK, you need to introduce jms.jar separately. Similarly, if you are going to use a third-party messaging protocol, Tibco RV is a good choice.

11. PDF processing library

In addition to Excel and Word,PDF is also a commonly used file format. If your application wants to support file processing in PDF format, you can use the iText and Apache FOP class libraries. Both provide very useful PDF processing capabilities.

Date and time Library

Before Java, the date and time library of JDK has always been criticized, such as its non-thread-safe, immutable, error-prone and so on. Many developers will choose the JodaTime class library that is more useful.

But after the launch of Java8, we can abandon JodaTime completely, because Java8 provides all its functions. However, if your code is running in an earlier version of JDK, then JodaTime is worth using.

XIII. Collection class library

Although JDK has a wealth of collection classes, there are still many third-party class libraries that provide more and better functionality. Such as Apache Commons Collections, Goldman Sachs collections, Google Collections and Trove. Trove is particularly useful because it provides faster versions of all standard Collections classes and the functionality of Collections classes that can operate directly on primitives (primitive), such as Map that contains int keys or values, and so on.

FastUtil is another similar API, which inherits Java Collection Framework, provides several specific types of containers, including mapping map, collection set, list list, priority queue (prority queue), implements the standard interface of java.util packages (and provides a two-way iterator that standard classes do not have), and provides large (64-bit) array, set, list, and fast and practical binary or text file IXO operation classes.

14. Email API

Javax.mail and Apache Commons Email provide api for sending mail. They are based on JavaMail API and provide simplified usage.

15. HTML parsing library

Like XML and JSON, HTML is another transport format that we may have to deal with. Fortunately, we have jsoup that greatly simplifies the use of HTML in Java applications. You can not only use JSoup to parse HTML but also create HTML documents.

XVI. Encryption library

Commons Codec in the Apache Commons family provides some common codec implementations, such as Base64, Hex, MD5,Phonetic andURLs and so on.

17. Embedded SQL database library

I really like an in-memory database like H2, which can be embedded in your Java application. If you need a database to verify your SQL when you are running a single test, it is a good choice. By the way, H2 is not the only embedded DB, you have Apache Derby and HSQL to choose from.

JDBC Fault diagnosis Library

Debugging is made easy by the existence of good JDBC extension libraries, such as P6spy, a dynamic monitoring framework for database access operations that allows database data to be intercepted and manipulated seamlessly without making any changes to the code of existing applications. The P6Spy distribution includes P6Log, which is an application that records all JDBC transactions of any Java application. When the configuration is completed, the data access performance can be monitored.

XIX. Serialization library

Google Protocol Buffer is a lightweight and efficient structured data storage format that can be used for structured data serialization, or serialization. It is very suitable for data storage or RPC data exchange format. Can be used in communication protocols, data storage and other fields of language-independent, platform-independent, extensible serialized structural data format. API in C++, Java and Python is currently available.

20. Network library

Some useful network libraries are mainly Netty and Apache MINA. If you are writing an application and you need to do the underlying network tasks, you can consider using these libraries.

These are useful libraries that every Java developer should be familiar with. The Java ecosystem is huge, and you'll find that there are many different libraries that can do different things. Everything you think of, there may be a library that can do it.

These are all the contents of the article "what are the common class libraries and API in Java development?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report