Java
org.apache.commons.io.IOUtils
closeQuietly()
toString()
copy()
toByteArray()
write()
toInputStream()
readLines()
copyLarge()
lineIterator()
readFully()
org.apache.commons.io.FileUtils
deleteDirectory()
readFileToString()
deleteQuietly()
copyFile()
writeStringToFile()
forceMkdir()
write()
listFiles()
copyDirectory()
forceDelete()
org.apache.commons.lang.StringUtils
isBlank()
isNotBlank()
isEmpty()
isNotEmpty()
equals()
join()
split()
EMPTY
trimToNull()
replace()
方法 |
说明 |
StringUtils.isEmpty |
判断字符串是否为空 |
StringUtils.isNotEmpty |
判断字符串是否非空 |
StringUtils.isBlank |
判断字符串是否为空,为null或者size==0 或者只存在空白字符(如””),则返回true |
StringUtils.isNotBlank |
判断字符串是否为非空 |
//StringUtils.isEmpty
System.out.println(StringUtils.isEmpty("")); //true
System.out.println(StringUtils.isEmpty(" ")); //false
//StringUtils.isNotEmpty
System.out.println(StringUtils.isNotEmpty("")); //false
//StringUtils.isBlank
System.out.println(StringUtils.isBlank("")); //true
System.out.println(StringUtils.isBlank(" ")); //true
//StringUtils.isNotBlank
System.out.println(StringUtils.isNotBlank(" ")); //false
org.apache.http.util.EntityUtils
toString()
consume()
toByteArray()
consumeQuietly()
getContentCharSet()
org.apache.commons.lang3.StringUtils
isBlank()
isNotBlank()
isEmpty()
isNotEmpty()
join()
equals()
split()
EMPTY
replace()
capitalize()
org.apache.commons.io.FilenameUtils
getExtension()
getBaseName()
getName()
concat()
removeExtension()
normalize()
wildcardMatch()
separatorsToUnix()
getFullPath()
isExtension()
org.springframework.util.StringUtils
hasText()
hasLength()
isEmpty()
commaDelimitedListToStringArray()
collectionToDelimitedString()
replace()
delimitedListToStringArray()
uncapitalize()
collectionToCommaDelimitedString()
tokenizeToStringArray()
org.apache.commons.lang.ArrayUtils
contains()
addAll()
clone()
isEmpty()
add()
EMPTY_BYTE_ARRAY
subarray()
indexOf()
isEquals()
toObject()
org.apache.commons.lang.StringEscapeUtils
escapeHtml()
unescapeHtml()
escapeXml()
escapeSql()
unescapeJava()
escapeJava()
escapeJavaScript()
unescapeXml()
unescapeJavaScript()
org.apache.http.client.utils.URLEncodedUtils
format()
parse()
org.apache.commons.codec.digest.DigestUtils
md5Hex()
shaHex()
sha256Hex()
sha1Hex()
sha()
md5()
sha512Hex()
sha1()
org.apache.commons.collections.CollectionUtils
isEmpty()
isNotEmpty()
select()
transform()
filter()
find()
collect()
forAllDo()
addAll()
isEqualCollection()
方法 |
说明 |
CollectionUtils.isEmpty |
判断集合是否为空,为null或者size==0 ,返回true |
CollectionUtils.isNotEmpty |
判断集合是否为非空 |
List<Integer> emptyList = new ArrayList<>();
List<Integer> nullList = null;
List<Integer> notEmptyList = new ArrayList<>();
notEmptyList.add(1);
//CollectionUtils.isEmpty
System.out.println(CollectionUtils.isEmpty(emptyList)); //true
System.out.println(CollectionUtils.isEmpty(nullList)); //true
System.out.println(CollectionUtils.isEmpty(notEmptyList)); //false
//CollectionUtils.isNotEmpty
System.out.println(CollectionUtils.isNotEmpty(emptyList)); //false
System.out.println(CollectionUtils.isNotEmpty(nullList)); //false
System.out.println(CollectionUtils.isNotEmpty(notEmptyList)); //true
org.apache.commons.lang3.ArrayUtils
contains()
isEmpty()
isNotEmpty()
add()
clone()
addAll()
subarray()
indexOf()
EMPTY_OBJECT_ARRAY
EMPTY_STRING_ARRAY
org.apache.commons.beanutils.PropertyUtils
getProperty()
setProperty()
getPropertyDescriptors()
isReadable()
copyProperties()
getPropertyDescriptor()
getSimpleProperty()
isWriteable()
setSimpleProperty()
getPropertyType()
org.apache.commons.lang3.StringEscapeUtils
unescapeHtml4()
escapeHtml4()
escapeXml()
unescapeXml()
escapeJava()
escapeEcmaScript()
unescapeJava()
escapeJson()
escapeXml10()
org.apache.commons.beanutils.BeanUtils
copyProperties()
getProperty()
setProperty()
describe()
populate()
copyProperty()
cloneBean()