Useful Java tools

1.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

2.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

3.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

4.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

5.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

6.org.apache.commons.codec.digest.DigestUtils

md5Hex: MD5 encryption, returns a 32 bit string
sha1Hex: SHA - 1 encryption
sha256Hex: SHA - 256 encryption
sha512Hex: the SHA - 512 Encryption
md5: MD5 encrypted string returns 16

 

Guess you like

Origin www.cnblogs.com/baby123/p/11318804.html