In Java, a utility class is a class that defines a set of methods that perform a common function.

The most commonly used Java utility classes and their most commonly used methods. The list of classes and its list of methods are sorted by popularity.

Hopefully, you’ll be able to browse through the list to get an idea of some of the features that are already available and popular, so you know you don’t need to implement them yourself. The names of these methods usually indicate what they do.

1.org.apache.commons.io.IOUtils

closeQuietly()  toString()  copy()  toByteArray()  write()  toInputStream()  readLines()  copyLarge()  lineIterator()  readFully()  
Copy the code

2.org.apache.commons.io.FileUtils

deleteDirectory()  readFileToString()  deleteQuietly()  copyFile()  writeStringToFile()  forceMkdir()  write()  listFiles()  copyDirectory()  forceDelete()  
Copy the code

3.org.apache.commons.lang.StringUtils

IsBlank () isNotBlank() isEmpty() isNotEmpty() equals() join() split() EMPTY trimToNull() replace()Copy the code

4.org.apache.http.util.EntityUtils

toString()  consume()  toByteArray()  consumeQuietly()  getContentCharSet()  
Copy the code

5.org.apache.commons.lang3.StringUtils

isBlank()  isNotBlank()  isEmpty()  isNotEmpty()  join()  equals()  split()  EMPTY  replace()  capitalize()  
Copy the code

6.org.apache.commons.io.FilenameUtils

getExtension()  getBaseName()  getName()  concat()  removeExtension()  normalize()  wildcardMatch()  separatorsToUnix()  getFullPath()  isExtension()  
Copy the code

7.org.springframework.util.StringUtils

hasText()  hasLength()  isEmpty()  commaDelimitedListToStringArray()  collectionToDelimitedString()  replace()  delimitedListToStringArray()  uncapitalize()  collectionToCommaDelimitedString()  tokenizeToStringArray()  
Copy the code

8.org.apache.commons.lang.ArrayUtils

Contains () addAll() Clone () isEmpty() www.cx1314.cnadd() EMPTY_BYTE_ARRAY subarray() indexOf() isEquals() toObject()Copy the code

9.org.apache.commons.lang.StringEscapeUtils

escapeHtml()  unescapeHtml()  escapeXml()  escapeSql()  unescapeJava()  escapeJava()  escapeJavaScript()  unescapeXml()  unescapeJavaScript()  
Copy the code

10.org.apache.http.client.utils.URLEncodedUtils

format()  parse()  
Copy the code

11.org.apache.commons.codec.digest.DigestUtils

md5Hex()  shaHex()  sha256Hex()  sha1Hex()  sha()  md5()  sha512Hex()  sha1()  
Copy the code

12.org.apache.commons.collections.CollectionUtils

isEmpty()  isNotEmpty()  select()  transform()  filter()  find()  collect()  forAllDo()  addAll()  isEqualCollection()  
Copy the code

13.org.apache.commons.lang3.ArrayUtils

contains()  isEmpty()  isNotEmpty()  add()                 clone()  addAll()  subarray()  indexOf()  EMPTY_OBJECT_ARRAY  EMPTY_STRING_ARRAY  
Copy the code

14.org.apache.commons.beanutils.PropertyUtils

getProperty()  setProperty()  getPropertyDescriptors()  isReadable()  copyProperties()  getPropertyDescriptor()  getSimpleProperty()  isWriteable()  setSimpleProperty()  getPropertyType()  
Copy the code

15.org.apache.commons.lang3.StringEscapeUtils

unescapeHtml4()  escapeHtml4()  escapeXml()  unescapeXml()  escapeJava()  escapeEcmaScript()  unescapeJava()  escapeJson()  escapeXml10()  
Copy the code

16.org.apache.commons.beanutils.BeanUtils

copyProperties()  getProperty()  setProperty()   describe()  populate()  copyProperty()  cloneBean()  
Copy the code

Download and learn: www.cx1314.cn/forum-64-1….

Have you used all of these Java utility classes?