- 博客(7)
- 收藏
- 关注
原创 Java读取csv文件
/** * 读取csv文件 文件里的 * @param srcPath * @return */ public static List<List<String>> readCSV(String srcPath) { List<List<String>> arrList = new ArrayList<>(); try (CSVReader csvReader =...
2021-11-24 10:49:57 402
原创 springboot下载文件
@RequestMapping("downloadKeywordTemplate") public void downloadKeywordTemplate(HttpServletResponse response) { try { String fileName = "keywords_template.csv"; InputStream inputStream = this.getClass().getClassLoader().getResourceAs
2021-11-24 10:42:45 208
原创 Java根据开始和结束时间获取该时间段内的所有日期
/** * 根据一段时间获取该段时间的所有日期 倒序排序 * @param startDate * @param endDate * @return yyyy-MM-dd */ public static List<String> getTwoDaysDay(String startDate, String endDate) { SimpleDateFormat sdf = new SimpleDateFormat("y
2021-09-23 17:20:45 2015
原创 Java删除文件
/** * 删除该目录filePath下的所有文件 * @param filePath 文件目录路径 */ public static void deleteFiles(String filePath) { File file = new File(filePath); if (file.exists()) { File[] files = file.listFiles(); for (in
2021-09-23 16:45:52 83
原创 Java导出CVS文件
/** * 生成CVS文件 * @param exportData 源数据List * @param map csv文件的列表头map * @param outPutPath 文件路径 * @param fileName 文件名称 * @return */ public static File createCSVFile(List exportData, LinkedHashMap map, String out
2021-09-23 16:43:14 169
原创 Java获取用户真实IP地址
public class IPUtil{ /** * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址, * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢? * 答案是取X-Forwarded-For...
2020-04-24 11:23:46 789
原创 HttpURLConnection工具类
public class HttpUtil { /** * get请求 * 返回httpcode */ public int sendHttpRequest(String sURL) { int httpRespCode = -1; StringBuffer sResult = new StringBuffer(); BufferedReader reader =...
2020-04-23 11:22:13 704
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人