netty
来源:互联网 发布:淘宝素材网站有哪些 编辑:程序博客网 时间:2024/05/18 12:40
本测试类是为了演示netty 4.1.9 版本中的DefaultAttributeMap的用法,至于DefaultAttributeMap内部数据结构解析改天再完善,主要现在有急事,粘贴完我就走人。
package com.lihong.DDPush;import io.netty.util.Attribute;import io.netty.util.AttributeKey;import io.netty.util.DefaultAttributeMap;import org.junit.Test;/** * Created by lihong10 on 2017/5/27. */public class AttributeTest { @Test public void testAttributeKey() { System.out.println(Integer.toBinaryString(-1)); AttributeKey<String> key1 = AttributeKey.newInstance("aa"); AttributeKey<String> key2 = AttributeKey.newInstance("bb"); AttributeKey<String> key3 = AttributeKey.newInstance("cc"); AttributeKey<String> key4 = AttributeKey.newInstance("dd"); AttributeKey<String> key5 = AttributeKey.newInstance("ee"); AttributeKey<String> key6 = AttributeKey.newInstance("ff"); AttributeKey<String> key7 = AttributeKey.newInstance("gg"); DefaultAttributeMap map = new DefaultAttributeMap(); Attribute<String> attr1 = map.attr(key1); Attribute<String> attr2 = map.attr(key2); Attribute<String> attr3 = map.attr(key3); Attribute<String> attr4 = map.attr(key4); Attribute<String> attr5 = map.attr(key5); Attribute<String> attr6 = map.attr(key6); Attribute<String> attr7 = map.attr(key7); System.out.println(attr1.getClass()); attr1.set("aa-value"); attr2.set("bb-value"); attr3.set("cc-value"); attr1.remove(); Attribute<String> attr1_1 = map.attr(key1); attr1_1.set("aa-new-value"); System.out.println(map.hasAttr(key1)); System.out.println(1&3); System.out.println(2&3); System.out.println(3&3); System.out.println(4&3); System.out.println(5&3); System.out.println(6&3); System.out.println(7&3); System.out.println(map.hasAttr(key1)); System.out.println(map.hasAttr(key2)); System.out.println(map.hasAttr(key3)); System.out.println(map.hasAttr(key4)); System.out.println(map.hasAttr(key5)); System.out.println(map.hasAttr(key6)); System.out.println(map.hasAttr(key7)); }}
阅读全文
0 0
- Netty
- Netty
- Netty
- Netty
- Netty
- Netty
- netty
- netty
- netty
- Netty
- Netty
- Netty
- Netty
- netty
- Netty
- Netty
- netty
- netty
- 线性变换与特征向量的一些理解
- linux下的can驱动测试
- Javascript优化
- MYSQL远程连接无权限
- 智能语音是开启新世界大门的钥匙
- netty
- POJ 1008 Maya Calendar
- No1154. Easy sort
- js赋值给angularjs ng-model 数据的千分位格式
- 寻找旋转数组中最小的数I和II
- C++之成员函数指针
- HTTPS 解析
- kibana之index字段类型更新
- 什么是内存泄漏?