@Component public class Utils extends Object
| 构造器和说明 |
|---|
Utils() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
covertStr(String str,
Class<?> tClass)
转换字符串
|
String |
getIp()
获取当前ip
|
String |
getMergedRegionValue(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
获取合并单元格的值
|
Date |
getNowDate()
获取当前格式化时间
|
String |
getStringFromInputStream(InputStream inputStream)
从输入流读取完整字符串
|
boolean |
isMergedRegion(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
判断指定的单元格是否是合并单元格
|
boolean |
isNumeric(String str)
利用正则表达式判断字符串是否是数字
|
static void |
main(String[] args) |
StringBuffer |
readFile(String strFile)
按行读取全部文件数据
|
org.springframework.data.domain.Sort |
sortAttr(Map<String,String> tableMap,
String sorterBy)
表格排序
|
String |
stringToTime(String date)
日期字符串转String型Time
|
Date |
timeToDate(String time)
time时间戳转Date
|
void |
writeToFile(String fileName,
String s)
写入文件
|
public static void main(String[] args) throws IOException
IOExceptionpublic Date getNowDate()
public String getStringFromInputStream(InputStream inputStream) throws IOException
inputStream - inputStreamIOException - IOExceptionpublic String getIp()
public String stringToTime(String date)
date - date字符串public org.springframework.data.domain.Sort sortAttr(Map<String,String> tableMap, String sorterBy)
tableMap - tableMapsorterBy - 默认按此属性排序public boolean isNumeric(String str)
str - strpublic boolean isMergedRegion(org.apache.poi.ss.usermodel.Sheet sheet,
int row,
int column)
sheet - sheetrow - 行下标column - 列下标public String getMergedRegionValue(org.apache.poi.ss.usermodel.Sheet sheet, int row, int column)
sheet - sheetrow - rowcolumn - columnpublic StringBuffer readFile(String strFile) throws IOException
strFile - strFileIOException - IOExceptionpublic void writeToFile(String fileName, String s) throws IOException
fileName - fileNames - 内容IOException - IOExceptionCopyright © 2021. All Rights Reserved.