OpslabJutil2.0历史API,请善用快捷进行搜索!
xxxxxxxxxx
271static String GBK 中文超大字符集
2static String ISO_8859_1 ISO 拉丁字母表 No.1,也叫作 ISO-LATIN-1
3static String US_ASCII 7位ASCII字符,也叫作ISO646-US、Unicode字符集的基本拉丁块
4static String UTF_16 16 位 UCS 转换格式,字节顺序由可选的字节顺序标记来标识
5static String UTF_16BE 16 位 UCS 转换格式,Big Endian(最低地址存放高位字节)字节顺序
6static String UTF_16LE 16 位 UCS 转换格式,Little-endian(最高地址存放低位字节)字节顺序
7static String UTF_8 8 位 UCS 转换格式
8
9
10static String changeCharset(String str, String newCharset)
11 字符串编码转换的实现方法
12static String changeCharset(String str, String oldCharset, String newCharset)
13 字符串编码转换的实现方法
14static String toASCII(String str)
15 将字符编码转换成US-ASCII码
16static String toGBK(String str)
17 将字符编码转换成GBK码
18static String toISO_8859_1(String str)
19 将字符编码转换成ISO-8859-1码
20static String toUTF_16(String str)
21 将字符编码转换成UTF-16码
22static String toUTF_16BE(String str)
23 将字符编码转换成UTF-16BE码
24static String toUTF_16LE(String str)
25 将字符编码转换成UTF-16LE码
26static String toUTF_8(String str)
27 将字符编码转换成UTF-8码
xxxxxxxxxx
181static List<String> getClassName(String packageName, boolean childPackage)
2static String[] getField(String className)
3 获取指定类的全部属性字段
4static String[] getMethod(String className)
5 获取对象的全部方法
6static void getter(Object obj, String att)
7 调用对象的getter方法
8static String initStr(String old)
9 Class loadClass(String className)
10 加载指定的类
11static <T> T propertiesCopy(Object obj, Class<T> type)
12 同名属性值复制 将对象obj内属性名同类型T内容有同名属性的值复制到类型T中,并返回一个类型T的对象
13static <T> T propertiesCopyIgnore(Object obj, Class<T> type)
14 同名属性值复制(忽略大小写) 将对象obj内属性名同类型T内容有同名属性的值复制到类型T中,并返回一个类型T的对象
15static <T> T propertiesCopyIgnoreFilter(Object obj, Class<T> type, String IgnoreStr)
16 同名属性值复制(比较时忽略字符IgnoreStr的内容) 将对象obj内属性名同类型T内容有同名属性的值复制到类型T中,并返回一个类型T的对象
17static void setter(Object obj, String att, Object value, Class<?> type)
18 调用对象的setter方法
xxxxxxxxxx
111static String getFirstSpell(String chinese)
2 获取汉字串拼音首字母,英文字符不变
3static String getFullSpell(String chinese)
4 获取汉字串拼音,英文字符不变
5static String getPingYin(String inputString)
6 将字符串中的中文转化为拼音,其他字符不变
7static boolean isChinese(String strName)
8static boolean isChineseByName(String str)
9static boolean isChineseByREG(String str)
10static boolean isMessyCode(String strName)
11 判断是否是乱码
xxxxxxxxxx
61static int bytesToInt(byte[] bytes)
2static long byteToLong(byte[] b)
3static short byteToShort(byte[] b)
4static byte[] intToByte(int i)
5static byte[] longToByte(long number)
6static byte[] shortToByte(short number)
xxxxxxxxxx
801static Date calculate(Date date, int second, String timeBurst)
2 时间Date在时间段(例如每天的08:00-18:00)上增加或减去second秒
3static Date calculate(String date, int second, String timeBurst)
4 时间Date在时间段(例如每天的08:00-18:00)上增加或减去second秒
5static String Date()
6 获取当前的日期
7static String Date(Date date)
8 将指定的时间格式化成出返回
9static Date Date(String dateStr)
10 将指定的字符串解析为时间类型
11static String DateTime()
12 获取当前日期时间
13static String DateTime(Date date)
14 将指定的时间格式化成出返回
15static Date DateTime(String datestr)
16 将指定的字符串解析为时间类型
17static Date day(Date date, int day)
18 在指定的时间上加或减去几天
19static Date day(int day)
20 在当前时间的基础上加或减去几天
21static Date hour(Date date, float hour)
22 在制定的时间上加或减去几小时-支持浮点数
23static Date hour(float hour)
24 在当前时间的基础上加或减去几小时-支持浮点数
25static boolean isDate(String date)
26 判断字符串是否为日期字符串
27static Date Minute(Date date, int minute)
28 在制定的时间上加或减去几分钟
29static Date Minute(int minute)
30 在当前时间的基础上加或减去几分钟
31static Date month(Date date, int month)
32 在指定的时间上加或减去几月
33static Date month(int month)
34 在当前时间的基础上加或减去几月
35static int subDay(Date startTime, Date endTime)
36 获取俩个时间之前的相隔的天数
37static int subDay(String startTime, String endTime)
38 获取俩个时间之前的相隔的天数
39static long subtimeBurst(Date startDate, Date endDate, String timeBurst)
40 返回俩个时间在时间段(例如每天的08:00-18:00)的时长-单位秒
41static long subtimeBurst(String startDate, String endDate, String timeBurst)
42 返回俩个时间在时间段(例如每天的08:00-18:00)的时长-单位秒
43static long Subtract(Date date1, Date date2)
44 时间date1和date2的时间差-单位秒
45static long Subtract(String date1, String date2)
46 时间date1和date2的时间差-单位秒
47static String SubtractDate(String date1, String date2)
48 获取俩个时间的查结果用时秒表示
49static int SubtractDay(Date date1, Date date2)
50 时间date1和date2的时间差-单位天
51static int SubtractDay(String date1, String date2)
52 时间date1和date2的时间差-单位天
53static int SubtractHour(Date date1, Date date2)
54 时间date1和date2的时间差-单位小时
55static int SubtractHour(String date1, String date2)
56 时间date1和date2的时间差-单位小时
57static int SubtractMinute(Date date1, Date date2)
58 时间date1和date2的时间差-单位分钟
59static int SubtractMinute(String date1, String date2)
60 时间date1和date2的时间差 -单位分钟
61static int SubtractMonth(Date date1, Date date2)
62 时间date1和date2的时间差-单位月
63static int SubtractMonth(String date1, String date2)
64 时间date1和date2的时间差-单位月
65static String SubtractTime(String date1, String date2)
66 获取俩个时间的查结果用时秒表示
67static int SubtractYear(Date date1, Date date2)
68 时间date1和date2的时间差-单位年
69static int SubtractYear(String date1, String date2)
70 时间date1和date2的时间差-单位年
71static String Time()
72 获取当前的时间
73static String Time(Date date)
74 讲指定的时间格式化成出返回
75static Date Time(String dateStr)
76 将指定的字符串解析为时间类型
77static Date year(Date date, int year)
78 在指定的时间上加或减去几年
79static Date year(int year)
80 在当前时间的基础上加或减去year年
xxxxxxxxxx
41 void doSendHtmlEmail(String subject, String sendHtml, String receiveUser)
2 发送邮件
3 void doSendHtmlEmail(String subject, String sendHtml, String receiveUser, File attachment)
4 发送邮件
xxxxxxxxxx
41static String commandPath(String file)
2 返回一个通用的文件路径
3static String getParentPath(String file)
4 返回相一个目录的对于本身的相对父目录
xxxxxxxxxx
581static boolean appendLine(File file, String str)
2 在文件末尾追加一行
3static boolean appendLine(File file, String str, String encoding)
4 在文件末尾追加一行
5static boolean cleanFile(File file)
6 快速清空一个超大的文件
7static boolean copy(File file, String targetFile)
8 复制文件 通过该方式复制文件文件越大速度越是明显
9static boolean copy(String resourcePath, String targetPath)
10 复制文件
11static void copyDir(File filePath, String targetPath)
12 复制目录
13static void copyDir(String filePath, String targetPath)
14 复制目录
15static int countLines(File file)
16 获取文件的行数
17static String cpdetector(File file)
18 获取文件的编码(cpDetector)探测
19static boolean createFiles(String filePaht)
20 创建文件支持多级目录
21static void createPaths(String paths)
22 创建多级目录
23static boolean deleteBigFile(File file)
24 快速的删除超大的文件
25static boolean deleteDir(File file)
26 删除一个目录
27static boolean deleteFile(File file)
28 删除一个文件
29static String FileType(File file)
30 获取文件的类型
31static String hash(File file)
32 获取文件的Hash
33static List<String> Lines(File file)
34 以列表的方式获取文件的所有行
35static List<String> Lines(File file, int lines)
36 以列表的方式获取文件的指定的行数数据
37static List<String> Lines(File file, int lines, String encoding)
38 以列表的方式获取文件的指定的行数数据
39static List<String> Lines(File file, String encoding)
40 以列表的方式获取文件的所有行
41static List<File> listFile(File path)
42 罗列指定路径下的全部文件
43static List<File> listFile(String path)
44 罗列指定路径下的全部文件
45static List<File> listFileAll(File path)
46 罗列指定路径下的全部文件包括文件夹
47static List<File> listFileFilter(File dirPath, String postfixs)
48 获取指定目录下的特点文件,通过后缀名过滤
49static String MimeType(String file)
50 获取文件的Mime类型
51static Date modifyTime(File file)
52 获取文件最后的修改时间
53static List<File> searchFile(File dirPath, String fileName)
54 在指定的目录下搜寻文个文件
55static List<File> searchFileReg(File dirPath, String reg)
56 查找符合正则表达式reg的的文件
57static String SimpleEncoding(String file)
58 利用简单的文件头字节特征探测文件编码
xxxxxxxxxx
91static void print(Enumeration enums)
2 遍历打印Enumeration
3static void print(List<?> list)
4 遍历打印遍历List集合
5static void print(Map map)
6 遍历打印Map集合
7static void print(String str)
8static void println(Object obj)
9static void println(String str)
xxxxxxxxxx
71static String GetAllProperties(String filePath)
2 读取Properties的全部信息
3static String GetValueByKey(String filePath, String key)
4 根据Key读取Value
5static String key(String key)
6static void WriteProperties(String filePath, String pKey, String pValue)
7 写入Properties信息
xxxxxxxxxx
231static int getNotSimple(int[] param, int len)
2 每次生成的len位数都不相同
3static String LowerString(int length)
4 返回一个定长的随机纯大写字母字符串(只包含大小写字母)
5static String MixString(int length)
6 返回一个定长的随机纯字母字符串(只包含大小写字母)
7static String number(int length)
8static String String(int length)
9 返回一个定长的随机字符串(只包含大小写字母、数字)
10static String toFixdLengthString(int num, int fixdlenth)
11 根据数字生成一个定长的字符串,长度不够前面补0
12static String toFixdLengthString(long num, int fixdlenth)
13 根据数字生成一个定长的字符串,长度不够前面补0
14static String UpperString(int length)
15 返回一个定长的随机纯小写字母字符串(只包含大小写字母)
16static String ZeroString(int length)
17 生成一个定长的纯0字符串
18static String uuid()
19 返回一个小写的uuid
20 public final static String UUID()
21 返回一个大写的uuid
22 public static String squid()
23 返回一个大写的有序列的uuid
xxxxxxxxxx
141static int countSubStrReg(String str, String reg)
2 获取符合reg正则表达式的字符串在String中出现的次数
3static boolean isABC(String src)
4 判断是否纯字母组合
5static boolean isEmail(String email)
6static boolean isFloatNumeric(String src)
7 判断是否浮点数字表示
8static boolean isInteger(String str)
9static boolean isMatche(String str, String reg)
10 判断字符串str是否符合正则表达式reg
11static boolean isNumeric(String src)
12 判断是否数字表示
13static boolean isNumericString(String src)
14 判断是否数字表示
xxxxxxxxxx
21static String FileMD5(File file)
2static String md5(String password)
xxxxxxxxxx
71static InputStream byte2InputStream(byte[] b)
2static byte[] inputStream2Byte(InputStream inStream)
3static byte[] stream2Byte(InputStream is)
4 void streamSaveAsFile(InputStream is, File outfile)
5 将流另存为文件
6static String streamToString(InputStream in)
7 Read an input stream into a string
xxxxxxxxxx
621static int countSubStr(String string, String str)
2 获取字符串str在String中出现的次数
3 String cpDetector(String str)
4 获取字符串的编码
5static String formatFloat(float f, String format)
6 格式化一个float
7static String full2Half(String str)
8 全角字符变半角字符
9static String getHideEmailPrefix(String email)
10 隐藏邮件地址前缀。
11static String getLimitLengthString(String str, int len, String symbol)
12 截取字符串 超出的字符用symbol代替
13static int getStringLen(String SrcStr)
14 取得字符串的实际长度(考虑了汉字的情况一个汉字按照俩个字符算)
15static boolean isEmpty(String s)
16 判断是否是空字符串 null和"" 都返回 true
17static boolean isIn(String substring, String[] source)
18 判断字符串数组中是否包含某字符串元素
19static String joinString(List array, String symbol)
20 把string array or list用给定的符号symbol连接成一个字符串
21static String joinString(String[] array, String symbol)
22 把string array or list用给定的符号symbol连接成一个字符串
23static String left(String input, int count)
24 截取字符串左侧指定长度的字符串
25static String listToStringSlipStr(List list, String slipStr)
26 将list 用传入的分隔符组装为String
27static String ltrim(String str1, int num)
28 截取字符串左侧的Num位
29static String middle(String input, int index, int count)
30 从指定位置开始截取指定长度的字符串
31static Map<String,String> parseQuery(String query, char split1, char split2, String dupLink)
32 解析字符串返回map键值对(例:a=1&b=2 => a=1,b=2)
33static List<String> parseString2ListByCustomerPattern(String pattern, String src)
34 根据指定的字符把源字符串分割成一个数组
35static String repeat(String src, int num)
36 repeat - 通过源字符串重复生成N次组成新的字符串。
37static String replaceAll(String s, String sf, String sb)
38 存文本替换
39static String replaceBlank(String str)
40 页面中去除字符串中的空格、回车、换行符、制表符
41static String replaceBracketStr(String str)
42 全角括号转为半角
43static boolean requals(String str1, String str2)
44 判定第一个字符串是否等于的第二个字符串中的某一个值
45static boolean requals(String str1, String str2, String split)
46 判定第一个字符串是否等于的第二个字符串中的某一个值
47static String right(String input, int count)
48 截取字符串右侧指定长度的字符串
49static String rtrim(String str1, int num)
50 截取字符串右侧的Num位
51static double SimilarDegree(String str1, String str2)
52 字符串相似度比较(速度较快)
53static double SimilarityRatio(String str1, String str2)
54 字符串相似度比较(速度较快)
55 String SimpleEncoding(String str)
56 获取字符串的编码
57static String string2Unicode(String string)
58static String subStringOmit(String subject, int size)
59 字符串省略截取 字符串截取到指定长度size+...的形式
60static String trimPunct(String str)
61 删除所有的标点符号
62static String unicode2String(String unicode)
xxxxxxxxxx
371static String CURRENT_USER
2 当前用户
3static String CURRENT_USER_DIR
4 当用用户的工作目录
5static String CURRENT_USER_HOME
6 当前用户的家目录
7static String FILE_SEPARATOR
8static String HOST_IP
9 主机IP
10static String HOST_NAME
11 主机名
12static String JVM_ENCODING
13 JVM的编码
14static String JVM_TEMPDIR
15 JVM默认的临时目录
16static String JVM_VERSION
17 JVM的版本
18static String LINE_SEPARATOR
19static String OS_ARCH
20 主机架构
21static String OS_NAME
22 主机类型
23static String OS_VERSION
24 主机类型版本
25static String PATH_SEPARATOR
26static String SUN_DESKTOP
27 操作系统类型
28static long TotalMemorySize
29 总的物理内存
30static long JVMfreeMem()
31 虚拟机空闲内存量
32static long JVMmaxMem()
33 虚拟机使用最大内存量
34static long JVMtotalMem()
35 获取JVM内存总量
36static long usedMemory()
37 已使用的物理内存
xxxxxxxxxx
81 static boolean isValid(Collection col)
2 判断集合的有效性
3 static boolean isValid(Object obj)
4 判断一个对象是否为空
5 static boolean isValid(Object[] arr)
6 判断数组是否有效
7 static boolean isValid(String src)
8 判断字符串有效性
xxxxxxxxxx
81static String escape(String src)
2static String getParamValue(String url, String paramName)
3static void print(HttpServletRequest request)
4static String removeParam(String url, String... paramNames)
5static String removeParam(String url, String paramName)
6static String setParam(String url, String paramName, String paramValue)
7static String unescape(String src)
8static String urlJoin(java.net.URL url, String locationHeader)
xxxxxxxxxx
51static void deCompress(File file, String dest)
2 文档压缩
3static void unCompress(File source, String path)
4 文档解压
5static void zipFile(File inFile, ZipOutputStream zos, String dir)
xxxxxxxxxx
131static void handler( Collection<T> collection, ObjectHandler<T> handler)
2 处理集合中的元素
3static <T, E> void process( Collection<T> collection, Collection<E> result, ObjectProcess<T, E> process)
4 处理集合中的元素
5```
6
7### FileHelper
8
9```java
10static void handlerWithLine(File file, String encoding, ObjectHandler<String> handler)
11 逐行处理文件内容
12static <E> void processWithLine(File file,String encoding, Collection<E> result, ObjectProcess<String,E> process)
13 逐行处理文件内容
xxxxxxxxxx
41static String encrypt(String secretKey, String Str)
2 使用ASE加密字符串(返回纯16进制字符串)
3static String decode(String secretKey, String str)
4 使用ASE解密字符串(解密纯16进制字符串)
xxxxxxxxxx
41static byte[] encrypt(String key,String str)
2 使用Blowfish加密算法加密字符串
3static String decrypt(String key,byte[] tt)
4 使用Blowfish加密算法解密字符串