Java is used most frequently and most versatile Java tools

In Java, the utility class defines a set of common methods, Java, the most frequently used and most versatile Java tools.

一. org.apache.commons.io.IOUtils

  • closeQuietly: Close an IO stream, socket, or selector does not throw an exception, generally placed in the finally block

  • toString: Conversion IO streams, Uri, byte [] is the String

  • copy: IO data stream copy, write to the output stream from the input stream, up to 2GB

  • toByteArray: from the input stream, URI acquisition byte []

  • write:. The character bytes to the output stream, etc.

  • toInputStream: the characters into the input stream

  • readLines: multiple rows of data read from the input stream, returns List <String>

  • copyLarge: the same copy, copy to support more than 2GB of data

  • lineIterator: flow returns an iterator from the input, the amount of data required parameters read, reading all, if the data is insufficient, fail

二. org.apache.commons.io.FileUtils

  • deleteDirectory: Delete the folder

  • readFileToString: read the contents of the file in characters

  • deleteQueitly: delete a file or folder and does not throw

  • copyFile: Copy files

  • writeStringToFile: the character written to the target file, if the file does not exist, create

  • forceMkdir: Forced to create the folder, if the folder parent directory does not exist, create parent

  • write: the character written to the specified file

  • listFiles: listed in a directory file (A filter)

  • copyDirectory: Copy the folder

  • forceDelete: forced to delete files

三. org.apache.commons.lang.StringUtils

  • isBlank: whether the string is empty (after determination trim)

  • isEmpty: the string is empty (no trim and judgment)

  • equals: for string equality

  • join: merge array is a single string, the separator may be passed

  • split: Split string

  • EMPTY: returns an empty string

  • trimToNull: After the conversion trim empty string is null

  • replace: replacement string

四. org.apache.http.util.EntityUtils

  • toString: Entity convert the string

  • consume: Entity ensure that the content of all consumed. You can see the source code in another Entity of content consumed, if the user does not consume, then it will be time to call Entity consumed

  • toByteArray: Entity convert the byte stream

  • consumeQuietly: and consume the same, but do not throw an exception

  • getContentCharset: get encoded content

五. org.apache.commons.lang3.StringUtils

  • isBlank: whether the string is empty (after determination trim)

  • isEmpty: the string is empty (no trim and judgment)

  • equals: for string equality

  • join: merge array is a single string, the separator may be passed

  • split: Split string

  • EMPTY: returns an empty string

  • replace: replacement string

  • capitalize: The first character uppercase

六. org.apache.commons.io.FilenameUtils

  • getExtension: Returns the file extension

  • getBaseName: Returns the file name extension is not included

  • getName: return the full file name

  • concat: (see Note method) by a combination of command-line style file path

  • removeExtension: Delete extension

  • normalize: the path to normalization

  • wildcardMatch: matching a wildcard

  • seperatorToUnix: path separator to the unix system format, i.e. /

  • getFullPath: get the file path, not including the file name

  • isExtension: Check the file extension is not passed parameters (List <String>) in a

七. org.springframework.util.StringUtils

  • hasText: Check if string contains text

  • hasLength: detecting whether the character string length is greater than 0

  • isEmpty: detecting whether the string is empty (if incoming object, it is determined whether the object is null)

  • commaDelimitedStringToArray: comma-delimited String into an array

  • collectionToDelimitedString: the collection into CSV format string

  • replace replacement string

  • delimitedListToStringArray: the equivalent of split

  • uncapitalize: the first letter lowercase

  • collectionToDelimitedCommaString: the collection into CSV format string

  • tokenizeToStringArray: split and essentially the same, but it can automatically remove blank words

八. org.apache.commons.lang.ArrayUtils

  • contains: if a certain string

  • addAll: Add the entire array

  • clone: ​​clone an array

  • isEmpty: whether empty array

  • add: add elements to an array

  • subarray: Interception array

  • indexOf: find the index of an element

  • isEquals: compare arrays for equality

  • toObject: basic type data array into a corresponding array of Object

九. org.apache.commons.lang.StringEscapeUtils

  • Reference five:

    org.apache.commons.lang3.StringEscapeUtils

十. org.apache.http.client.utils.URLEncodedUtils

  • format: formatting parameters, returns an HTTP POST or HTTP PUT available application / x-www-form-urlencoded string

  • parse: URI, or the like into String List <NameValuePair>

Eleven. Org.apache.commons.codec.digest.DigestUtils

  • md5Hex: MD5 encryption, returns a 32 bit string

  • sha1Hex: SHA-1 Encryption

  • sha256Hex: SHA-256 encryption

  • sha512Hex: SHA-512 encryption

  • md5: MD5 encrypted string returns 16

十二. org.apache.commons.collections.CollectionUtils

  • isEmpty: is empty

  • select: Filter element according to the conditions set

  • transform: collection element according to the specified processing method, similar to the List map ()

  • filter: filter elements, Leise List of filter ()

  • find: Basic and select the same

  • collect: and transform almost the same, but returns a new array

  • forAllDo: call the specified method for each element

  • isEqualCollection: determining whether two sets consistent

十三. org.apache.commons.lang3.ArrayUtils

  • contains: Within Strings

  • addAll: Add the entire array

  • clone: ​​clone an array

  • isEmpty: whether empty array

  • add: add elements to an array

  • subarray: Interception array

  • indexOf: find the index of an element

  • isEquals: compare arrays for equality

  • toObject: basic type data array into a corresponding array of Object

Fourteen. Org.apache.commons.beanutils.PropertyUtils

  • getProperty: Get Object Property Value

  • setProperty: Set object property value

  • getPropertyDiscriptor: Get Attribute Descriptor

  • isReadable: Check the property is accessible

  • copyProperties: Attribute values ​​are copied from one object to another

  • getPropertyDiscriptors: Get all the properties descriptor

  • isWriteable: Check the attribute is writable

  • getPropertyType: Gets the type of object properties

Fifteen. Org.apache.commons.lang3.StringEscapeUtils

  • unescapeHtml4: Escape html

  • escapeHtml4: unescapes html

  • escapeXml: Escape xml

  • unescapeXml: unescapes xml

  • escapeJava: Escape unicode encoding

  • escapeEcmaScript: EcmaScript escape character

  • unescapeJava: unescapes unicode encoding

  • escapeJson: Escape character json

  • escapeXml10: Escape Xml10

This has now been abandoned, the proposed method uses the commons-text package inside.

Sixteen. Org.apache.commons.beanutils.BeanUtils

  • copyPeoperties: Attribute values ​​are copied from one object to another

  • getProperty: Get Object Property Value

  • setProperty: Set object property value

  • populate: Copy the properties according to the Map

  • copyPeoperty: copy a single value, from one object to another

  • cloneBean: Cloning bean instance

Guess you like

Origin www.cnblogs.com/wuxu/p/11371498.html