随笔分类 -  JAVA

JAVA一些常用的方法
摘要:package com.weixin.sendmessage; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; im 阅读全文
posted @ 2019-11-12 15:49 yvioo 阅读(2604) 评论(0) 推荐(0)
摘要:SendTextToAllUserAct.java package com.weixin.sendmessage; import org.apache.commons.lang.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.Sta 阅读全文
posted @ 2019-11-12 15:21 yvioo 阅读(2594) 评论(1) 推荐(1)
摘要:官网接口地址:https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html //创建一个微信菜单实体类 WeixinMenu.java package com.weixi 阅读全文
posted @ 2019-11-12 13:57 yvioo 阅读(1676) 评论(0) 推荐(0)
摘要:天气接口地址:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl 1、打开项目文件目录路径文件夹,在当前文件夹打开cmd,输入 wsimport -keep -p demo.cyj.service -verbose htt 阅读全文
posted @ 2019-10-30 18:18 yvioo 阅读(15936) 评论(0) 推荐(1)
摘要:一、导入jar包 poi-3.7.jarpoi-scratchpad-3.7.jarpoi-examples-3.7.jarpoi-ooxml-3.7.jarpoi-ooxml-schemas-3.7.jar xmlbeans-2.3.0.jar maven <dependency> <groupI 阅读全文
posted @ 2019-10-17 10:23 yvioo 阅读(8975) 评论(4) 推荐(2)
摘要:对页面传入的参数值进行过滤,过滤方法如下 public static String xssEncode(String s) { if (s == null || s.equals("")) { return s; } try { s = URLDecoder.decode(s, "UTF-8"); 阅读全文
posted @ 2019-10-07 16:23 yvioo 阅读(2574) 评论(0) 推荐(0)
摘要:新增一个拦截器,在拦截器doFilter()方法增加以下代码 阅读全文
posted @ 2019-10-07 16:03 yvioo 阅读(3554) 评论(0) 推荐(1)
摘要:一、点击File-New-Project,选择Spring initializr ,选择jdk1.8及以上 二、填写相关信息,点击Next 3、选择Web -Spring Web,点击Next 4、输入项目名和选择项目路径 点击Finish,项目就创建完成了 阅读全文
posted @ 2019-10-02 19:05 yvioo 阅读(1536) 评论(0) 推荐(0)
摘要:在settings.xml文件中的mirrors下添加mirror标签 <!-- 阿里云仓库 --> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven 阅读全文
posted @ 2019-10-02 16:04 yvioo 阅读(132876) 评论(0) 推荐(4)
摘要:/** * * @param urlStr 接口地址 * @param xmlInfo xml格式参数数据 * @return */ public static String sendMsgXml(String urlStr, String xmlInfo) { StringBuffer buffer = new StringBuffer(); try { URL url = new URL(ur 阅读全文
posted @ 2019-08-30 18:49 yvioo 阅读(6593) 评论(0) 推荐(1)
摘要:/** * java获取raw */ public static String readRaw(InputStream inputStream) { String result = ""; try { ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int l 阅读全文
posted @ 2019-08-30 18:41 yvioo 阅读(9759) 评论(0) 推荐(1)
摘要:/** * 获取指定日期是星期几<br> * * @param date * @return 指定日期是星期几 */ public static String getWeekOfDate(Date date) { String[] weekDays = { "星期日", "星期一", "星期二", 阅读全文
posted @ 2019-05-24 15:23 yvioo 阅读(17820) 评论(0) 推荐(0)
摘要:public static Map getLngAndLat(String address) { Map map = new HashMap(); String url = "http://api.map.baidu.com/geocoder/v2/?address=" + address + "&output=json&ak=你的ak"; //这里需要自己申... 阅读全文
posted @ 2019-05-03 15:34 yvioo 阅读(3530) 评论(0) 推荐(0)
摘要://java 通过url下载图片保存到本地 public static void download(String urlString, int i) throws Exception { // 构造URL URL url = new URL(urlString); // 打开连接 URLConnection con = u... 阅读全文
posted @ 2019-05-03 15:31 yvioo 阅读(27335) 评论(0) 推荐(3)
摘要:首先先要导入pinyin4j-2.5.0.jar 这个jar包 阅读全文
posted @ 2019-05-03 15:31 yvioo 阅读(449) 评论(0) 推荐(0)
摘要:public static String getSixNum() { String str = "0123456789"; StringBuilder sb = new StringBuilder(4); for (int i = 0; i < 6; i++) { char ch = str.charAt(new Random().nextInt(str.length()));... 阅读全文
posted @ 2019-05-03 15:24 yvioo 阅读(2500) 评论(0) 推荐(0)
摘要:Enumeration<String> paraNames=request.getParameterNames(); for(Enumeration<String> e=paraNames;e.hasMoreElements()){ String thisName=e.nextElement()+" 阅读全文
posted @ 2019-05-03 15:19 yvioo 阅读(8108) 评论(0) 推荐(0)
摘要:public static List getImg(String htmlStr) { List list = new ArrayList(); String img = ""; Pattern p_image; Matcher m_image; // String regEx_img = "]*?>"; //图片链... 阅读全文
posted @ 2019-05-03 15:12 yvioo 阅读(2254) 评论(0) 推荐(0)
摘要:package com.common.util; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 检测是否为移动端设备访问 * */ public class CheckMobile { // \b 是单词边 阅读全文
posted @ 2019-03-26 21:45 yvioo 阅读(3035) 评论(0) 推荐(0)
摘要:注:不是所有的字都支持,如果对识别要求特别高的,不建议使用 import java.io.UnsupportedEncodingException; /** * 取得给定汉字串的首字母串,即声母串 * Title: ChineseCharToEn * @date 注:只支持GB2312字符集中的汉字 阅读全文
posted @ 2019-03-26 21:44 yvioo 阅读(16108) 评论(2) 推荐(0)