- 博客(18)
- 收藏
- 关注
原创 Netty入门
1.客户端package cn.enjoyedu.ch02.echo;import io.netty.bootstrap.Bootstrap;import io.netty.channel.ChannelFuture;import io.netty.channel.EventLoopGroup;import io.netty.channel.nio.NioEventLoopGroup;import io.netty.channel.socket.nio.NioSocketChannel;i
2021-01-16 10:23:55 122
原创 spring bean注入
1、使用配置注入对象向beans.xml注入bean:<bean id="person" class="com.enjoy.cap1.Person"> <property name="name" value="james"></property> <property name="age" value="19"></property></bean>获取bean //把beans.xml的类加载到容器 Applicatio
2020-09-13 14:40:28 219
原创 java位运算
按位与(&)按位与的运算规则 操作数1 0 0 1 1 操作数2 0 1 0 1 按位与 0 0 0 1 规则总结:只有两个操作数对应位同为1时,结果为1,其余全为0. (或
2020-08-12 19:28:43 189
原创 java8List.sort()排序功能
//按照List中对象的id属性升序list.sort(Comparator.comparing(Stu::getId))//按照List中对象的id属性降序list.sort(Comparator.comparing(Stu::getId).reversed());//多条件升序list.sort(Comparator.comparing(Stu::getId).thenCompari...
2019-08-29 10:54:35 86325 4
原创 自定义异常
springboot自定义异常//运行期异常方法上面不需要throws 异常public class CustomException extends RuntimeException {//错误代码ResultCode resultCode;public CustomException(ResultCode resultCode){ this.resultCode = resu...
2019-06-02 11:08:41 179
转载 XmlUtil
public class XmlUtil { /** * @description 将xml字符串转换成map * @param xml * @return Map */ public static Map convertXmlToMap(String xml) { Map map = new HashMap(); Document doc = nu...
2019-04-06 13:21:51 323
转载 FastDFSClient
public class FastDFSClient {private TrackerClient trackerClient = null;private TrackerServer trackerServer = null;private StorageServer storageServer = null;private StorageClient1 storageClient = ...
2019-04-05 10:15:39 189
转载 IkUtil
public class IkUtil {public static Set analyzer(String analyzerString) {Set set = new HashSet();TokenStream stream;try {// 创建分词的io流,将title进行分词stream = new IKAnalyzer(true).tokenStream(“myfield”,...
2019-04-05 10:14:27 384
转载 TenpayUtil
public class TenpayUtil {//private static Object Server;/** * 把对象转换成字符串 * * @param obj * @return String 转换成字符串,若对象为null,则返回空字符串. *//*public static String toString(Object obj) { if (obj ==...
2019-04-05 10:13:01 370
转载 RedisCache
/**Redis缓存管理类@author Administrator*/public class RedisCache implements Cache{ private RedisTemplate<String, Object> redisTemplate; private String name; public RedisTemplate<S...
2019-04-05 10:12:27 4694
转载 PhoneFormatCheckUtils
public class PhoneFormatCheckUtils {/** * 大陆号码或香港号码均可 */ public static boolean isPhoneLegal(String str)throws PatternSyntaxException { return isChinaPhoneLegal(str) || isHKPhoneLegal(str)...
2019-04-05 10:11:33 281
转载 MD5Util
/**md5加密工具类@author Administrator*/public class MD5Util {/** * 创建md5摘要,规则是:按参数名称a-z排序,遇到空值的参数不参加签名。 */public static String createSign(SortedMap<String, String> packageParams, String...
2019-04-05 10:10:30 124
转载 JsonUtil
/**JSON工具类@author Administrator*/public class JsonUtil {/** * 将json中的某个key提出来, * @param jsonString * @param key * @return */public static String convertJsonToArray(String jsonString,Stri...
2019-04-05 10:09:06 93
转载 JmsUtil
/**JMS工具类@author Administrator*/@Componentpublic class JmsUtil {@Autowiredprivate JmsTemplate jmsTemplate;/** * 发送消息 * @param destination * @param map */public void send(Destination d...
2019-04-05 10:07:54 147
转载 CacheUtil
/**缓存工具类@author Administrator*/public class CacheUtil {private RedisTemplate<String, Object> redisTemplate;public void setRedisTemplate(RedisTemplate<String, Object> redisTemplat...
2019-04-05 10:06:51 964
转载 IdWorker
/**名称:IdWorker.java描述:分布式自增长IDTwitter的 Snowflake JAVA实现方案核心代码为其IdWorker这个类实现,其原理结构如下,我分别用一个0表示一位,用—分割开部分的作用:1||0—0000000000 0000000000 0000000000 0000000000 0 — 00000 —00000 —0000...
2019-04-05 10:02:42 3152
转载 HttpClient
/***http请求客户端*/public class HttpClient {private String url;private Map<String, String> param;private int statusCode;private String content;private String xmlParam;private boolean is...
2019-04-05 10:00:26 113
转载 CookieUtil
/***Cookie 工具类*/public final class CookieUtil {/** * 得到Cookie的值, 不编码 * * @param request * @param cookieName * @return */public static String getCookieValue(HttpServletRequest request, ...
2019-04-05 09:51:18 91
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人