├── TestNettyClient
├── .classpath
├── .gitignore
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── ReadMe.txt
├── lib
│ ├── netty-all-5.0.0.Alpha1.jar
│ └── protobuf-java-2.5.0.jar
├── proto
│ └── info.proto
├── resources
│ └── LoginUi
│ │ ├── button_login_down.png
│ │ ├── button_login_hover.png
│ │ ├── button_login_normal.png
│ │ ├── close.png
│ │ ├── close_hover.png
│ │ ├── edit_frame_hover.png
│ │ ├── edit_frame_hover_reversed.png
│ │ ├── edit_frame_normal.png
│ │ ├── edit_frame_normal_reversed.png
│ │ ├── generate.png
│ │ ├── head.png
│ │ ├── morning.jpg
│ │ ├── pwd.png
│ │ └── user.png
└── src
│ └── com
│ └── drdg
│ └── netty
│ ├── agreement
│ └── MsgAgreement.java
│ ├── bean
│ ├── InformationPacket.java
│ └── UserBean.java
│ ├── client
│ ├── ChildChannelHandler.java
│ ├── NettyClient.java
│ └── TimeClientHandler.java
│ ├── control
│ └── CoreBusinessControl.java
│ ├── service
│ └── MsgHandleService.java
│ ├── thread
│ └── ClientThreadPool.java
│ └── view
│ ├── GroupChat.java
│ └── MM.java
└── TestNettyServer
├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── bin
└── .gitignore
├── lib
├── netty-all-5.0.0.Alpha1.jar
└── protobuf-java-2.5.0.jar
├── proto
└── info.proto
└── src
└── com
└── drdg
└── netty
├── agreement
└── MsgAgreement.java
├── bean
└── InformationPacket.java
├── server
├── ChildChannelHandler.java
├── NettyServer.java
├── StartServer.java
└── TimeServerHandler.java
└── service
└── MsgHandleService.java
/TestNettyClient/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TestNettyClient/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 |
--------------------------------------------------------------------------------
/TestNettyClient/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNettyClient
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/TestNettyClient/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/TestNettyClient/ReadMe.txt:
--------------------------------------------------------------------------------
1 | E:\workspace\TestNettyServer\proto>protoc --java_out=E:\workspace\TestNettyServe
2 | r\src\ info.proto
--------------------------------------------------------------------------------
/TestNettyClient/lib/netty-all-5.0.0.Alpha1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/lib/netty-all-5.0.0.Alpha1.jar
--------------------------------------------------------------------------------
/TestNettyClient/lib/protobuf-java-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/lib/protobuf-java-2.5.0.jar
--------------------------------------------------------------------------------
/TestNettyClient/proto/info.proto:
--------------------------------------------------------------------------------
1 | option java_package = "com.drdg.netty.bean";
2 | option java_outer_classname = "InformationPacket";
3 |
4 | message Group{
5 | required MsgEnum msgEnum = 1;
6 | required Login login = 2;
7 | required MsgInfo msgInfo = 3;
8 | required ServerConnectEnum serverConnectEnum = 4;
9 | repeated User userList = 5;
10 |
11 | enum ServerConnectEnum{
12 | Request = 1;
13 | Success = 2;
14 | Failure = 3;
15 | }
16 |
17 | message User{
18 | required string id = 1;
19 | required string userName = 2;
20 | required string userPwd = 3;
21 | }
22 | }
23 |
24 |
25 | message Login{
26 | required string userName = 1;
27 | required string userPwd = 2;
28 | required LoinEnum loginState = 3;
29 | required string feedBackInfo = 4;
30 |
31 | enum LoinEnum{
32 |
33 | Request = 1;
34 | Success = 2;
35 | Failure = 3;
36 |
37 | }
38 | }
39 |
40 | message MsgInfo{
41 | required string sendUser = 1;
42 | required string sendToUser = 2;
43 | required string sendInfo = 3;
44 | }
45 |
46 | enum MsgEnum{
47 |
48 | ReuqestToConnect = 1;
49 | CheckToLogin = 2;
50 | ChatOneToOne = 3;
51 | ChatOneToAll = 4;
52 | ChatToFriend = 5;
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/button_login_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/button_login_down.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/button_login_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/button_login_hover.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/button_login_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/button_login_normal.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/close.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/close_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/close_hover.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/edit_frame_hover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/edit_frame_hover.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/edit_frame_hover_reversed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/edit_frame_hover_reversed.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/edit_frame_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/edit_frame_normal.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/edit_frame_normal_reversed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/edit_frame_normal_reversed.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/generate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/generate.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/head.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/morning.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/morning.jpg
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/pwd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/pwd.png
--------------------------------------------------------------------------------
/TestNettyClient/resources/LoginUi/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyClient/resources/LoginUi/user.png
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/agreement/MsgAgreement.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.agreement;
2 |
3 | import java.util.List;
4 |
5 | import com.drdg.netty.bean.InformationPacket;
6 | import com.drdg.netty.bean.InformationPacket.Group.User;
7 |
8 | public class MsgAgreement {
9 |
10 | private InformationPacket.Group group;
11 | private InformationPacket.Login login;
12 | private InformationPacket.MsgInfo msgInfo;
13 | private InformationPacket.Group.User user;
14 |
15 | @SuppressWarnings("unused")
16 | private MsgAgreement(){}
17 |
18 | public MsgAgreement(boolean bool){
19 |
20 | if(bool){
21 |
22 | login = InformationPacket.Login.newBuilder()
23 | .setUserName("")
24 | .setUserPwd("")
25 | .setLoginState(InformationPacket.Login.LoinEnum.Request)
26 | .setFeedBackInfo("")
27 | .build();
28 |
29 | msgInfo = InformationPacket.MsgInfo.newBuilder()
30 | .setSendUser("")
31 | .setSendToUser("")
32 | .setSendInfo("")
33 | .build();
34 |
35 | user = InformationPacket.Group.User.newBuilder()
36 | .setId("")
37 | .setUserName("")
38 | .setUserPwd("")
39 | .build();
40 |
41 |
42 | group = InformationPacket.Group.newBuilder()
43 | .setLogin(login)
44 | .setMsgInfo(msgInfo)
45 | .setMsgEnum(InformationPacket.MsgEnum.ReuqestToConnect)
46 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Request)
47 | .addUserList(user)
48 | .build();
49 |
50 |
51 | }
52 |
53 | }
54 |
55 | /**
56 | * get connect server agreement Group
57 | * @param serverConnectEnum
58 | * @return
59 | */
60 | public InformationPacket.Group doGetConnectServerInfoPacket(InformationPacket.Group.ServerConnectEnum serverConnectEnum){
61 | group = InformationPacket.Group.newBuilder()
62 | .setLogin(login)
63 | .setMsgInfo(msgInfo)
64 | .setMsgEnum(InformationPacket.MsgEnum.ReuqestToConnect)
65 | .setServerConnectEnum(serverConnectEnum)
66 | .addUserList(user)
67 | .build();
68 |
69 | return group;
70 | }
71 |
72 | /**
73 | * get login agreement Group
74 | * @param userName
75 | * @param userPwd
76 | * @return InformationPacket.Group
77 | */
78 | public InformationPacket.Group doGetLoginInfoPacket(String userName,String userPwd){
79 |
80 | InformationPacket.Login login = InformationPacket.Login.newBuilder()
81 | .setUserName(userName)
82 | .setUserPwd(userPwd)
83 | .setLoginState(InformationPacket.Login.LoinEnum.Request)
84 | .setFeedBackInfo("")
85 | .build();
86 |
87 | group = InformationPacket.Group.newBuilder()
88 | .setLogin(login)
89 | .setMsgInfo(msgInfo)
90 | .setMsgEnum(InformationPacket.MsgEnum.CheckToLogin)
91 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success)
92 | .addUserList(user)
93 | .build();
94 |
95 | return group;
96 |
97 | }
98 |
99 | /**
100 | * get checked login agreement Group
101 | * @param userName
102 | * @param userPwd
103 | * @param loginEnum
104 | * @param feedBackInfo
105 | * @return
106 | */
107 | public InformationPacket.Group doGetLoginInfoPacket(String userName,String userPwd,InformationPacket.Login.LoinEnum loginEnum,String feedBackInfo){
108 |
109 |
110 | InformationPacket.Login login = InformationPacket.Login.newBuilder()
111 | .setUserName(userName)
112 | .setUserPwd(userPwd)
113 | .setLoginState(loginEnum)
114 | .setFeedBackInfo(feedBackInfo)
115 | .build();
116 |
117 | group = InformationPacket.Group.newBuilder()
118 | .setLogin(login)
119 | .setMsgInfo(msgInfo)
120 | .setMsgEnum(InformationPacket.MsgEnum.CheckToLogin)
121 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success)
122 | .addUserList(user)
123 | .build();
124 |
125 | return group;
126 |
127 | }
128 |
129 | /**
130 | * get chat friends list
131 | * @param userList
132 | * @return
133 | */
134 | public InformationPacket.Group doGetChatFriendsListInfoPacket(List userList){
135 |
136 | InformationPacket.Group.Builder groupBuilder = InformationPacket.Group.newBuilder();
137 | groupBuilder.setLogin(login);
138 | groupBuilder.setMsgInfo(msgInfo);
139 | groupBuilder.setMsgEnum(InformationPacket.MsgEnum.ChatToFriend);
140 | groupBuilder.setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success);
141 | for (User user : userList) {
142 | groupBuilder.addUserList(user);
143 | }
144 | group = groupBuilder.build();
145 |
146 | return group;
147 | }
148 |
149 | /**
150 | * get group send info packet
151 | * @param userName
152 | * @param msgStr
153 | * @return
154 | */
155 | public InformationPacket.Group doGetGroupSendInfoPacket(String userName,String msgStr){
156 |
157 | msgInfo = InformationPacket.MsgInfo.newBuilder()
158 | .setSendUser(userName)
159 | .setSendToUser("")
160 | .setSendInfo(msgStr)
161 | .build();
162 |
163 | group = InformationPacket.Group.newBuilder()
164 | .setLogin(login)
165 | .setMsgInfo(msgInfo)
166 | .setMsgEnum(InformationPacket.MsgEnum.ChatOneToAll)
167 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success)
168 | .addUserList(user)
169 | .build();
170 |
171 | return group;
172 |
173 | }
174 |
175 | }
176 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/bean/InformationPacket.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: info.proto
3 |
4 | package com.drdg.netty.bean;
5 |
6 | public final class InformationPacket {
7 | private InformationPacket() {}
8 | public static void registerAllExtensions(
9 | com.google.protobuf.ExtensionRegistry registry) {
10 | }
11 | /**
12 | * Protobuf enum {@code MsgEnum}
13 | */
14 | public enum MsgEnum
15 | implements com.google.protobuf.ProtocolMessageEnum {
16 | /**
17 | * ReuqestToConnect = 1;
18 | */
19 | ReuqestToConnect(0, 1),
20 | /**
21 | * CheckToLogin = 2;
22 | */
23 | CheckToLogin(1, 2),
24 | /**
25 | * ChatOneToOne = 3;
26 | */
27 | ChatOneToOne(2, 3),
28 | /**
29 | * ChatOneToAll = 4;
30 | */
31 | ChatOneToAll(3, 4),
32 | /**
33 | * ChatToFriend = 5;
34 | */
35 | ChatToFriend(4, 5),
36 | ;
37 |
38 | /**
39 | * ReuqestToConnect = 1;
40 | */
41 | public static final int ReuqestToConnect_VALUE = 1;
42 | /**
43 | * CheckToLogin = 2;
44 | */
45 | public static final int CheckToLogin_VALUE = 2;
46 | /**
47 | * ChatOneToOne = 3;
48 | */
49 | public static final int ChatOneToOne_VALUE = 3;
50 | /**
51 | * ChatOneToAll = 4;
52 | */
53 | public static final int ChatOneToAll_VALUE = 4;
54 | /**
55 | * ChatToFriend = 5;
56 | */
57 | public static final int ChatToFriend_VALUE = 5;
58 |
59 |
60 | public final int getNumber() { return value; }
61 |
62 | public static MsgEnum valueOf(int value) {
63 | switch (value) {
64 | case 1: return ReuqestToConnect;
65 | case 2: return CheckToLogin;
66 | case 3: return ChatOneToOne;
67 | case 4: return ChatOneToAll;
68 | case 5: return ChatToFriend;
69 | default: return null;
70 | }
71 | }
72 |
73 | public static com.google.protobuf.Internal.EnumLiteMap
74 | internalGetValueMap() {
75 | return internalValueMap;
76 | }
77 | private static com.google.protobuf.Internal.EnumLiteMap
78 | internalValueMap =
79 | new com.google.protobuf.Internal.EnumLiteMap() {
80 | public MsgEnum findValueByNumber(int number) {
81 | return MsgEnum.valueOf(number);
82 | }
83 | };
84 |
85 | public final com.google.protobuf.Descriptors.EnumValueDescriptor
86 | getValueDescriptor() {
87 | return getDescriptor().getValues().get(index);
88 | }
89 | public final com.google.protobuf.Descriptors.EnumDescriptor
90 | getDescriptorForType() {
91 | return getDescriptor();
92 | }
93 | public static final com.google.protobuf.Descriptors.EnumDescriptor
94 | getDescriptor() {
95 | return com.drdg.netty.bean.InformationPacket.getDescriptor().getEnumTypes().get(0);
96 | }
97 |
98 | private static final MsgEnum[] VALUES = values();
99 |
100 | public static MsgEnum valueOf(
101 | com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
102 | if (desc.getType() != getDescriptor()) {
103 | throw new java.lang.IllegalArgumentException(
104 | "EnumValueDescriptor is not for this type.");
105 | }
106 | return VALUES[desc.getIndex()];
107 | }
108 |
109 | private final int index;
110 | private final int value;
111 |
112 | private MsgEnum(int index, int value) {
113 | this.index = index;
114 | this.value = value;
115 | }
116 |
117 | // @@protoc_insertion_point(enum_scope:MsgEnum)
118 | }
119 |
120 | public interface GroupOrBuilder
121 | extends com.google.protobuf.MessageOrBuilder {
122 |
123 | // required .MsgEnum msgEnum = 1;
124 | /**
125 | * required .MsgEnum msgEnum = 1;
126 | */
127 | boolean hasMsgEnum();
128 | /**
129 | * required .MsgEnum msgEnum = 1;
130 | */
131 | com.drdg.netty.bean.InformationPacket.MsgEnum getMsgEnum();
132 |
133 | // required .Login login = 2;
134 | /**
135 | * required .Login login = 2;
136 | */
137 | boolean hasLogin();
138 | /**
139 | * required .Login login = 2;
140 | */
141 | com.drdg.netty.bean.InformationPacket.Login getLogin();
142 | /**
143 | * required .Login login = 2;
144 | */
145 | com.drdg.netty.bean.InformationPacket.LoginOrBuilder getLoginOrBuilder();
146 |
147 | // required .MsgInfo msgInfo = 3;
148 | /**
149 | * required .MsgInfo msgInfo = 3;
150 | */
151 | boolean hasMsgInfo();
152 | /**
153 | * required .MsgInfo msgInfo = 3;
154 | */
155 | com.drdg.netty.bean.InformationPacket.MsgInfo getMsgInfo();
156 | /**
157 | * required .MsgInfo msgInfo = 3;
158 | */
159 | com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder getMsgInfoOrBuilder();
160 |
161 | // required .Group.ServerConnectEnum serverConnectEnum = 4;
162 | /**
163 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
164 | */
165 | boolean hasServerConnectEnum();
166 | /**
167 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
168 | */
169 | com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum getServerConnectEnum();
170 |
171 | // repeated .Group.User userList = 5;
172 | /**
173 | * repeated .Group.User userList = 5;
174 | */
175 | java.util.List
176 | getUserListList();
177 | /**
178 | * repeated .Group.User userList = 5;
179 | */
180 | com.drdg.netty.bean.InformationPacket.Group.User getUserList(int index);
181 | /**
182 | * repeated .Group.User userList = 5;
183 | */
184 | int getUserListCount();
185 | /**
186 | * repeated .Group.User userList = 5;
187 | */
188 | java.util.List extends com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder>
189 | getUserListOrBuilderList();
190 | /**
191 | * repeated .Group.User userList = 5;
192 | */
193 | com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder getUserListOrBuilder(
194 | int index);
195 | }
196 | /**
197 | * Protobuf type {@code Group}
198 | */
199 | public static final class Group extends
200 | com.google.protobuf.GeneratedMessage
201 | implements GroupOrBuilder {
202 | // Use Group.newBuilder() to construct.
203 | private Group(com.google.protobuf.GeneratedMessage.Builder> builder) {
204 | super(builder);
205 | this.unknownFields = builder.getUnknownFields();
206 | }
207 | private Group(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
208 |
209 | private static final Group defaultInstance;
210 | public static Group getDefaultInstance() {
211 | return defaultInstance;
212 | }
213 |
214 | public Group getDefaultInstanceForType() {
215 | return defaultInstance;
216 | }
217 |
218 | private final com.google.protobuf.UnknownFieldSet unknownFields;
219 | @java.lang.Override
220 | public final com.google.protobuf.UnknownFieldSet
221 | getUnknownFields() {
222 | return this.unknownFields;
223 | }
224 | private Group(
225 | com.google.protobuf.CodedInputStream input,
226 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
227 | throws com.google.protobuf.InvalidProtocolBufferException {
228 | initFields();
229 | int mutable_bitField0_ = 0;
230 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
231 | com.google.protobuf.UnknownFieldSet.newBuilder();
232 | try {
233 | boolean done = false;
234 | while (!done) {
235 | int tag = input.readTag();
236 | switch (tag) {
237 | case 0:
238 | done = true;
239 | break;
240 | default: {
241 | if (!parseUnknownField(input, unknownFields,
242 | extensionRegistry, tag)) {
243 | done = true;
244 | }
245 | break;
246 | }
247 | case 8: {
248 | int rawValue = input.readEnum();
249 | com.drdg.netty.bean.InformationPacket.MsgEnum value = com.drdg.netty.bean.InformationPacket.MsgEnum.valueOf(rawValue);
250 | if (value == null) {
251 | unknownFields.mergeVarintField(1, rawValue);
252 | } else {
253 | bitField0_ |= 0x00000001;
254 | msgEnum_ = value;
255 | }
256 | break;
257 | }
258 | case 18: {
259 | com.drdg.netty.bean.InformationPacket.Login.Builder subBuilder = null;
260 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
261 | subBuilder = login_.toBuilder();
262 | }
263 | login_ = input.readMessage(com.drdg.netty.bean.InformationPacket.Login.PARSER, extensionRegistry);
264 | if (subBuilder != null) {
265 | subBuilder.mergeFrom(login_);
266 | login_ = subBuilder.buildPartial();
267 | }
268 | bitField0_ |= 0x00000002;
269 | break;
270 | }
271 | case 26: {
272 | com.drdg.netty.bean.InformationPacket.MsgInfo.Builder subBuilder = null;
273 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
274 | subBuilder = msgInfo_.toBuilder();
275 | }
276 | msgInfo_ = input.readMessage(com.drdg.netty.bean.InformationPacket.MsgInfo.PARSER, extensionRegistry);
277 | if (subBuilder != null) {
278 | subBuilder.mergeFrom(msgInfo_);
279 | msgInfo_ = subBuilder.buildPartial();
280 | }
281 | bitField0_ |= 0x00000004;
282 | break;
283 | }
284 | case 32: {
285 | int rawValue = input.readEnum();
286 | com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum value = com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum.valueOf(rawValue);
287 | if (value == null) {
288 | unknownFields.mergeVarintField(4, rawValue);
289 | } else {
290 | bitField0_ |= 0x00000008;
291 | serverConnectEnum_ = value;
292 | }
293 | break;
294 | }
295 | case 42: {
296 | if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
297 | userList_ = new java.util.ArrayList();
298 | mutable_bitField0_ |= 0x00000010;
299 | }
300 | userList_.add(input.readMessage(com.drdg.netty.bean.InformationPacket.Group.User.PARSER, extensionRegistry));
301 | break;
302 | }
303 | }
304 | }
305 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
306 | throw e.setUnfinishedMessage(this);
307 | } catch (java.io.IOException e) {
308 | throw new com.google.protobuf.InvalidProtocolBufferException(
309 | e.getMessage()).setUnfinishedMessage(this);
310 | } finally {
311 | if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) {
312 | userList_ = java.util.Collections.unmodifiableList(userList_);
313 | }
314 | this.unknownFields = unknownFields.build();
315 | makeExtensionsImmutable();
316 | }
317 | }
318 | public static final com.google.protobuf.Descriptors.Descriptor
319 | getDescriptor() {
320 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_descriptor;
321 | }
322 |
323 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
324 | internalGetFieldAccessorTable() {
325 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_fieldAccessorTable
326 | .ensureFieldAccessorsInitialized(
327 | com.drdg.netty.bean.InformationPacket.Group.class, com.drdg.netty.bean.InformationPacket.Group.Builder.class);
328 | }
329 |
330 | public static com.google.protobuf.Parser PARSER =
331 | new com.google.protobuf.AbstractParser() {
332 | public Group parsePartialFrom(
333 | com.google.protobuf.CodedInputStream input,
334 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
335 | throws com.google.protobuf.InvalidProtocolBufferException {
336 | return new Group(input, extensionRegistry);
337 | }
338 | };
339 |
340 | @java.lang.Override
341 | public com.google.protobuf.Parser getParserForType() {
342 | return PARSER;
343 | }
344 |
345 | /**
346 | * Protobuf enum {@code Group.ServerConnectEnum}
347 | */
348 | public enum ServerConnectEnum
349 | implements com.google.protobuf.ProtocolMessageEnum {
350 | /**
351 | * Request = 1;
352 | */
353 | Request(0, 1),
354 | /**
355 | * Success = 2;
356 | */
357 | Success(1, 2),
358 | /**
359 | * Failure = 3;
360 | */
361 | Failure(2, 3),
362 | ;
363 |
364 | /**
365 | * Request = 1;
366 | */
367 | public static final int Request_VALUE = 1;
368 | /**
369 | * Success = 2;
370 | */
371 | public static final int Success_VALUE = 2;
372 | /**
373 | * Failure = 3;
374 | */
375 | public static final int Failure_VALUE = 3;
376 |
377 |
378 | public final int getNumber() { return value; }
379 |
380 | public static ServerConnectEnum valueOf(int value) {
381 | switch (value) {
382 | case 1: return Request;
383 | case 2: return Success;
384 | case 3: return Failure;
385 | default: return null;
386 | }
387 | }
388 |
389 | public static com.google.protobuf.Internal.EnumLiteMap
390 | internalGetValueMap() {
391 | return internalValueMap;
392 | }
393 | private static com.google.protobuf.Internal.EnumLiteMap
394 | internalValueMap =
395 | new com.google.protobuf.Internal.EnumLiteMap() {
396 | public ServerConnectEnum findValueByNumber(int number) {
397 | return ServerConnectEnum.valueOf(number);
398 | }
399 | };
400 |
401 | public final com.google.protobuf.Descriptors.EnumValueDescriptor
402 | getValueDescriptor() {
403 | return getDescriptor().getValues().get(index);
404 | }
405 | public final com.google.protobuf.Descriptors.EnumDescriptor
406 | getDescriptorForType() {
407 | return getDescriptor();
408 | }
409 | public static final com.google.protobuf.Descriptors.EnumDescriptor
410 | getDescriptor() {
411 | return com.drdg.netty.bean.InformationPacket.Group.getDescriptor().getEnumTypes().get(0);
412 | }
413 |
414 | private static final ServerConnectEnum[] VALUES = values();
415 |
416 | public static ServerConnectEnum valueOf(
417 | com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
418 | if (desc.getType() != getDescriptor()) {
419 | throw new java.lang.IllegalArgumentException(
420 | "EnumValueDescriptor is not for this type.");
421 | }
422 | return VALUES[desc.getIndex()];
423 | }
424 |
425 | private final int index;
426 | private final int value;
427 |
428 | private ServerConnectEnum(int index, int value) {
429 | this.index = index;
430 | this.value = value;
431 | }
432 |
433 | // @@protoc_insertion_point(enum_scope:Group.ServerConnectEnum)
434 | }
435 |
436 | public interface UserOrBuilder
437 | extends com.google.protobuf.MessageOrBuilder {
438 |
439 | // required string id = 1;
440 | /**
441 | * required string id = 1;
442 | */
443 | boolean hasId();
444 | /**
445 | * required string id = 1;
446 | */
447 | java.lang.String getId();
448 | /**
449 | * required string id = 1;
450 | */
451 | com.google.protobuf.ByteString
452 | getIdBytes();
453 |
454 | // required string userName = 2;
455 | /**
456 | * required string userName = 2;
457 | */
458 | boolean hasUserName();
459 | /**
460 | * required string userName = 2;
461 | */
462 | java.lang.String getUserName();
463 | /**
464 | * required string userName = 2;
465 | */
466 | com.google.protobuf.ByteString
467 | getUserNameBytes();
468 |
469 | // required string userPwd = 3;
470 | /**
471 | * required string userPwd = 3;
472 | */
473 | boolean hasUserPwd();
474 | /**
475 | * required string userPwd = 3;
476 | */
477 | java.lang.String getUserPwd();
478 | /**
479 | * required string userPwd = 3;
480 | */
481 | com.google.protobuf.ByteString
482 | getUserPwdBytes();
483 | }
484 | /**
485 | * Protobuf type {@code Group.User}
486 | */
487 | public static final class User extends
488 | com.google.protobuf.GeneratedMessage
489 | implements UserOrBuilder {
490 | // Use User.newBuilder() to construct.
491 | private User(com.google.protobuf.GeneratedMessage.Builder> builder) {
492 | super(builder);
493 | this.unknownFields = builder.getUnknownFields();
494 | }
495 | private User(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
496 |
497 | private static final User defaultInstance;
498 | public static User getDefaultInstance() {
499 | return defaultInstance;
500 | }
501 |
502 | public User getDefaultInstanceForType() {
503 | return defaultInstance;
504 | }
505 |
506 | private final com.google.protobuf.UnknownFieldSet unknownFields;
507 | @java.lang.Override
508 | public final com.google.protobuf.UnknownFieldSet
509 | getUnknownFields() {
510 | return this.unknownFields;
511 | }
512 | private User(
513 | com.google.protobuf.CodedInputStream input,
514 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
515 | throws com.google.protobuf.InvalidProtocolBufferException {
516 | initFields();
517 | int mutable_bitField0_ = 0;
518 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
519 | com.google.protobuf.UnknownFieldSet.newBuilder();
520 | try {
521 | boolean done = false;
522 | while (!done) {
523 | int tag = input.readTag();
524 | switch (tag) {
525 | case 0:
526 | done = true;
527 | break;
528 | default: {
529 | if (!parseUnknownField(input, unknownFields,
530 | extensionRegistry, tag)) {
531 | done = true;
532 | }
533 | break;
534 | }
535 | case 10: {
536 | bitField0_ |= 0x00000001;
537 | id_ = input.readBytes();
538 | break;
539 | }
540 | case 18: {
541 | bitField0_ |= 0x00000002;
542 | userName_ = input.readBytes();
543 | break;
544 | }
545 | case 26: {
546 | bitField0_ |= 0x00000004;
547 | userPwd_ = input.readBytes();
548 | break;
549 | }
550 | }
551 | }
552 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
553 | throw e.setUnfinishedMessage(this);
554 | } catch (java.io.IOException e) {
555 | throw new com.google.protobuf.InvalidProtocolBufferException(
556 | e.getMessage()).setUnfinishedMessage(this);
557 | } finally {
558 | this.unknownFields = unknownFields.build();
559 | makeExtensionsImmutable();
560 | }
561 | }
562 | public static final com.google.protobuf.Descriptors.Descriptor
563 | getDescriptor() {
564 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_User_descriptor;
565 | }
566 |
567 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
568 | internalGetFieldAccessorTable() {
569 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_User_fieldAccessorTable
570 | .ensureFieldAccessorsInitialized(
571 | com.drdg.netty.bean.InformationPacket.Group.User.class, com.drdg.netty.bean.InformationPacket.Group.User.Builder.class);
572 | }
573 |
574 | public static com.google.protobuf.Parser PARSER =
575 | new com.google.protobuf.AbstractParser() {
576 | public User parsePartialFrom(
577 | com.google.protobuf.CodedInputStream input,
578 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
579 | throws com.google.protobuf.InvalidProtocolBufferException {
580 | return new User(input, extensionRegistry);
581 | }
582 | };
583 |
584 | @java.lang.Override
585 | public com.google.protobuf.Parser getParserForType() {
586 | return PARSER;
587 | }
588 |
589 | private int bitField0_;
590 | // required string id = 1;
591 | public static final int ID_FIELD_NUMBER = 1;
592 | private java.lang.Object id_;
593 | /**
594 | * required string id = 1;
595 | */
596 | public boolean hasId() {
597 | return ((bitField0_ & 0x00000001) == 0x00000001);
598 | }
599 | /**
600 | * required string id = 1;
601 | */
602 | public java.lang.String getId() {
603 | java.lang.Object ref = id_;
604 | if (ref instanceof java.lang.String) {
605 | return (java.lang.String) ref;
606 | } else {
607 | com.google.protobuf.ByteString bs =
608 | (com.google.protobuf.ByteString) ref;
609 | java.lang.String s = bs.toStringUtf8();
610 | if (bs.isValidUtf8()) {
611 | id_ = s;
612 | }
613 | return s;
614 | }
615 | }
616 | /**
617 | * required string id = 1;
618 | */
619 | public com.google.protobuf.ByteString
620 | getIdBytes() {
621 | java.lang.Object ref = id_;
622 | if (ref instanceof java.lang.String) {
623 | com.google.protobuf.ByteString b =
624 | com.google.protobuf.ByteString.copyFromUtf8(
625 | (java.lang.String) ref);
626 | id_ = b;
627 | return b;
628 | } else {
629 | return (com.google.protobuf.ByteString) ref;
630 | }
631 | }
632 |
633 | // required string userName = 2;
634 | public static final int USERNAME_FIELD_NUMBER = 2;
635 | private java.lang.Object userName_;
636 | /**
637 | * required string userName = 2;
638 | */
639 | public boolean hasUserName() {
640 | return ((bitField0_ & 0x00000002) == 0x00000002);
641 | }
642 | /**
643 | * required string userName = 2;
644 | */
645 | public java.lang.String getUserName() {
646 | java.lang.Object ref = userName_;
647 | if (ref instanceof java.lang.String) {
648 | return (java.lang.String) ref;
649 | } else {
650 | com.google.protobuf.ByteString bs =
651 | (com.google.protobuf.ByteString) ref;
652 | java.lang.String s = bs.toStringUtf8();
653 | if (bs.isValidUtf8()) {
654 | userName_ = s;
655 | }
656 | return s;
657 | }
658 | }
659 | /**
660 | * required string userName = 2;
661 | */
662 | public com.google.protobuf.ByteString
663 | getUserNameBytes() {
664 | java.lang.Object ref = userName_;
665 | if (ref instanceof java.lang.String) {
666 | com.google.protobuf.ByteString b =
667 | com.google.protobuf.ByteString.copyFromUtf8(
668 | (java.lang.String) ref);
669 | userName_ = b;
670 | return b;
671 | } else {
672 | return (com.google.protobuf.ByteString) ref;
673 | }
674 | }
675 |
676 | // required string userPwd = 3;
677 | public static final int USERPWD_FIELD_NUMBER = 3;
678 | private java.lang.Object userPwd_;
679 | /**
680 | * required string userPwd = 3;
681 | */
682 | public boolean hasUserPwd() {
683 | return ((bitField0_ & 0x00000004) == 0x00000004);
684 | }
685 | /**
686 | * required string userPwd = 3;
687 | */
688 | public java.lang.String getUserPwd() {
689 | java.lang.Object ref = userPwd_;
690 | if (ref instanceof java.lang.String) {
691 | return (java.lang.String) ref;
692 | } else {
693 | com.google.protobuf.ByteString bs =
694 | (com.google.protobuf.ByteString) ref;
695 | java.lang.String s = bs.toStringUtf8();
696 | if (bs.isValidUtf8()) {
697 | userPwd_ = s;
698 | }
699 | return s;
700 | }
701 | }
702 | /**
703 | * required string userPwd = 3;
704 | */
705 | public com.google.protobuf.ByteString
706 | getUserPwdBytes() {
707 | java.lang.Object ref = userPwd_;
708 | if (ref instanceof java.lang.String) {
709 | com.google.protobuf.ByteString b =
710 | com.google.protobuf.ByteString.copyFromUtf8(
711 | (java.lang.String) ref);
712 | userPwd_ = b;
713 | return b;
714 | } else {
715 | return (com.google.protobuf.ByteString) ref;
716 | }
717 | }
718 |
719 | private void initFields() {
720 | id_ = "";
721 | userName_ = "";
722 | userPwd_ = "";
723 | }
724 | private byte memoizedIsInitialized = -1;
725 | public final boolean isInitialized() {
726 | byte isInitialized = memoizedIsInitialized;
727 | if (isInitialized != -1) return isInitialized == 1;
728 |
729 | if (!hasId()) {
730 | memoizedIsInitialized = 0;
731 | return false;
732 | }
733 | if (!hasUserName()) {
734 | memoizedIsInitialized = 0;
735 | return false;
736 | }
737 | if (!hasUserPwd()) {
738 | memoizedIsInitialized = 0;
739 | return false;
740 | }
741 | memoizedIsInitialized = 1;
742 | return true;
743 | }
744 |
745 | public void writeTo(com.google.protobuf.CodedOutputStream output)
746 | throws java.io.IOException {
747 | getSerializedSize();
748 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
749 | output.writeBytes(1, getIdBytes());
750 | }
751 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
752 | output.writeBytes(2, getUserNameBytes());
753 | }
754 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
755 | output.writeBytes(3, getUserPwdBytes());
756 | }
757 | getUnknownFields().writeTo(output);
758 | }
759 |
760 | private int memoizedSerializedSize = -1;
761 | public int getSerializedSize() {
762 | int size = memoizedSerializedSize;
763 | if (size != -1) return size;
764 |
765 | size = 0;
766 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
767 | size += com.google.protobuf.CodedOutputStream
768 | .computeBytesSize(1, getIdBytes());
769 | }
770 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
771 | size += com.google.protobuf.CodedOutputStream
772 | .computeBytesSize(2, getUserNameBytes());
773 | }
774 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
775 | size += com.google.protobuf.CodedOutputStream
776 | .computeBytesSize(3, getUserPwdBytes());
777 | }
778 | size += getUnknownFields().getSerializedSize();
779 | memoizedSerializedSize = size;
780 | return size;
781 | }
782 |
783 | private static final long serialVersionUID = 0L;
784 | @java.lang.Override
785 | protected java.lang.Object writeReplace()
786 | throws java.io.ObjectStreamException {
787 | return super.writeReplace();
788 | }
789 |
790 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(
791 | com.google.protobuf.ByteString data)
792 | throws com.google.protobuf.InvalidProtocolBufferException {
793 | return PARSER.parseFrom(data);
794 | }
795 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(
796 | com.google.protobuf.ByteString data,
797 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
798 | throws com.google.protobuf.InvalidProtocolBufferException {
799 | return PARSER.parseFrom(data, extensionRegistry);
800 | }
801 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(byte[] data)
802 | throws com.google.protobuf.InvalidProtocolBufferException {
803 | return PARSER.parseFrom(data);
804 | }
805 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(
806 | byte[] data,
807 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
808 | throws com.google.protobuf.InvalidProtocolBufferException {
809 | return PARSER.parseFrom(data, extensionRegistry);
810 | }
811 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(java.io.InputStream input)
812 | throws java.io.IOException {
813 | return PARSER.parseFrom(input);
814 | }
815 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(
816 | java.io.InputStream input,
817 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
818 | throws java.io.IOException {
819 | return PARSER.parseFrom(input, extensionRegistry);
820 | }
821 | public static com.drdg.netty.bean.InformationPacket.Group.User parseDelimitedFrom(java.io.InputStream input)
822 | throws java.io.IOException {
823 | return PARSER.parseDelimitedFrom(input);
824 | }
825 | public static com.drdg.netty.bean.InformationPacket.Group.User parseDelimitedFrom(
826 | java.io.InputStream input,
827 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
828 | throws java.io.IOException {
829 | return PARSER.parseDelimitedFrom(input, extensionRegistry);
830 | }
831 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(
832 | com.google.protobuf.CodedInputStream input)
833 | throws java.io.IOException {
834 | return PARSER.parseFrom(input);
835 | }
836 | public static com.drdg.netty.bean.InformationPacket.Group.User parseFrom(
837 | com.google.protobuf.CodedInputStream input,
838 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
839 | throws java.io.IOException {
840 | return PARSER.parseFrom(input, extensionRegistry);
841 | }
842 |
843 | public static Builder newBuilder() { return Builder.create(); }
844 | public Builder newBuilderForType() { return newBuilder(); }
845 | public static Builder newBuilder(com.drdg.netty.bean.InformationPacket.Group.User prototype) {
846 | return newBuilder().mergeFrom(prototype);
847 | }
848 | public Builder toBuilder() { return newBuilder(this); }
849 |
850 | @java.lang.Override
851 | protected Builder newBuilderForType(
852 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
853 | Builder builder = new Builder(parent);
854 | return builder;
855 | }
856 | /**
857 | * Protobuf type {@code Group.User}
858 | */
859 | public static final class Builder extends
860 | com.google.protobuf.GeneratedMessage.Builder
861 | implements com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder {
862 | public static final com.google.protobuf.Descriptors.Descriptor
863 | getDescriptor() {
864 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_User_descriptor;
865 | }
866 |
867 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
868 | internalGetFieldAccessorTable() {
869 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_User_fieldAccessorTable
870 | .ensureFieldAccessorsInitialized(
871 | com.drdg.netty.bean.InformationPacket.Group.User.class, com.drdg.netty.bean.InformationPacket.Group.User.Builder.class);
872 | }
873 |
874 | // Construct using com.drdg.netty.bean.InformationPacket.Group.User.newBuilder()
875 | private Builder() {
876 | maybeForceBuilderInitialization();
877 | }
878 |
879 | private Builder(
880 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
881 | super(parent);
882 | maybeForceBuilderInitialization();
883 | }
884 | private void maybeForceBuilderInitialization() {
885 | if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
886 | }
887 | }
888 | private static Builder create() {
889 | return new Builder();
890 | }
891 |
892 | public Builder clear() {
893 | super.clear();
894 | id_ = "";
895 | bitField0_ = (bitField0_ & ~0x00000001);
896 | userName_ = "";
897 | bitField0_ = (bitField0_ & ~0x00000002);
898 | userPwd_ = "";
899 | bitField0_ = (bitField0_ & ~0x00000004);
900 | return this;
901 | }
902 |
903 | public Builder clone() {
904 | return create().mergeFrom(buildPartial());
905 | }
906 |
907 | public com.google.protobuf.Descriptors.Descriptor
908 | getDescriptorForType() {
909 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_User_descriptor;
910 | }
911 |
912 | public com.drdg.netty.bean.InformationPacket.Group.User getDefaultInstanceForType() {
913 | return com.drdg.netty.bean.InformationPacket.Group.User.getDefaultInstance();
914 | }
915 |
916 | public com.drdg.netty.bean.InformationPacket.Group.User build() {
917 | com.drdg.netty.bean.InformationPacket.Group.User result = buildPartial();
918 | if (!result.isInitialized()) {
919 | throw newUninitializedMessageException(result);
920 | }
921 | return result;
922 | }
923 |
924 | public com.drdg.netty.bean.InformationPacket.Group.User buildPartial() {
925 | com.drdg.netty.bean.InformationPacket.Group.User result = new com.drdg.netty.bean.InformationPacket.Group.User(this);
926 | int from_bitField0_ = bitField0_;
927 | int to_bitField0_ = 0;
928 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
929 | to_bitField0_ |= 0x00000001;
930 | }
931 | result.id_ = id_;
932 | if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
933 | to_bitField0_ |= 0x00000002;
934 | }
935 | result.userName_ = userName_;
936 | if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
937 | to_bitField0_ |= 0x00000004;
938 | }
939 | result.userPwd_ = userPwd_;
940 | result.bitField0_ = to_bitField0_;
941 | onBuilt();
942 | return result;
943 | }
944 |
945 | public Builder mergeFrom(com.google.protobuf.Message other) {
946 | if (other instanceof com.drdg.netty.bean.InformationPacket.Group.User) {
947 | return mergeFrom((com.drdg.netty.bean.InformationPacket.Group.User)other);
948 | } else {
949 | super.mergeFrom(other);
950 | return this;
951 | }
952 | }
953 |
954 | public Builder mergeFrom(com.drdg.netty.bean.InformationPacket.Group.User other) {
955 | if (other == com.drdg.netty.bean.InformationPacket.Group.User.getDefaultInstance()) return this;
956 | if (other.hasId()) {
957 | bitField0_ |= 0x00000001;
958 | id_ = other.id_;
959 | onChanged();
960 | }
961 | if (other.hasUserName()) {
962 | bitField0_ |= 0x00000002;
963 | userName_ = other.userName_;
964 | onChanged();
965 | }
966 | if (other.hasUserPwd()) {
967 | bitField0_ |= 0x00000004;
968 | userPwd_ = other.userPwd_;
969 | onChanged();
970 | }
971 | this.mergeUnknownFields(other.getUnknownFields());
972 | return this;
973 | }
974 |
975 | public final boolean isInitialized() {
976 | if (!hasId()) {
977 |
978 | return false;
979 | }
980 | if (!hasUserName()) {
981 |
982 | return false;
983 | }
984 | if (!hasUserPwd()) {
985 |
986 | return false;
987 | }
988 | return true;
989 | }
990 |
991 | public Builder mergeFrom(
992 | com.google.protobuf.CodedInputStream input,
993 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
994 | throws java.io.IOException {
995 | com.drdg.netty.bean.InformationPacket.Group.User parsedMessage = null;
996 | try {
997 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
998 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
999 | parsedMessage = (com.drdg.netty.bean.InformationPacket.Group.User) e.getUnfinishedMessage();
1000 | throw e;
1001 | } finally {
1002 | if (parsedMessage != null) {
1003 | mergeFrom(parsedMessage);
1004 | }
1005 | }
1006 | return this;
1007 | }
1008 | private int bitField0_;
1009 |
1010 | // required string id = 1;
1011 | private java.lang.Object id_ = "";
1012 | /**
1013 | * required string id = 1;
1014 | */
1015 | public boolean hasId() {
1016 | return ((bitField0_ & 0x00000001) == 0x00000001);
1017 | }
1018 | /**
1019 | * required string id = 1;
1020 | */
1021 | public java.lang.String getId() {
1022 | java.lang.Object ref = id_;
1023 | if (!(ref instanceof java.lang.String)) {
1024 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
1025 | .toStringUtf8();
1026 | id_ = s;
1027 | return s;
1028 | } else {
1029 | return (java.lang.String) ref;
1030 | }
1031 | }
1032 | /**
1033 | * required string id = 1;
1034 | */
1035 | public com.google.protobuf.ByteString
1036 | getIdBytes() {
1037 | java.lang.Object ref = id_;
1038 | if (ref instanceof String) {
1039 | com.google.protobuf.ByteString b =
1040 | com.google.protobuf.ByteString.copyFromUtf8(
1041 | (java.lang.String) ref);
1042 | id_ = b;
1043 | return b;
1044 | } else {
1045 | return (com.google.protobuf.ByteString) ref;
1046 | }
1047 | }
1048 | /**
1049 | * required string id = 1;
1050 | */
1051 | public Builder setId(
1052 | java.lang.String value) {
1053 | if (value == null) {
1054 | throw new NullPointerException();
1055 | }
1056 | bitField0_ |= 0x00000001;
1057 | id_ = value;
1058 | onChanged();
1059 | return this;
1060 | }
1061 | /**
1062 | * required string id = 1;
1063 | */
1064 | public Builder clearId() {
1065 | bitField0_ = (bitField0_ & ~0x00000001);
1066 | id_ = getDefaultInstance().getId();
1067 | onChanged();
1068 | return this;
1069 | }
1070 | /**
1071 | * required string id = 1;
1072 | */
1073 | public Builder setIdBytes(
1074 | com.google.protobuf.ByteString value) {
1075 | if (value == null) {
1076 | throw new NullPointerException();
1077 | }
1078 | bitField0_ |= 0x00000001;
1079 | id_ = value;
1080 | onChanged();
1081 | return this;
1082 | }
1083 |
1084 | // required string userName = 2;
1085 | private java.lang.Object userName_ = "";
1086 | /**
1087 | * required string userName = 2;
1088 | */
1089 | public boolean hasUserName() {
1090 | return ((bitField0_ & 0x00000002) == 0x00000002);
1091 | }
1092 | /**
1093 | * required string userName = 2;
1094 | */
1095 | public java.lang.String getUserName() {
1096 | java.lang.Object ref = userName_;
1097 | if (!(ref instanceof java.lang.String)) {
1098 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
1099 | .toStringUtf8();
1100 | userName_ = s;
1101 | return s;
1102 | } else {
1103 | return (java.lang.String) ref;
1104 | }
1105 | }
1106 | /**
1107 | * required string userName = 2;
1108 | */
1109 | public com.google.protobuf.ByteString
1110 | getUserNameBytes() {
1111 | java.lang.Object ref = userName_;
1112 | if (ref instanceof String) {
1113 | com.google.protobuf.ByteString b =
1114 | com.google.protobuf.ByteString.copyFromUtf8(
1115 | (java.lang.String) ref);
1116 | userName_ = b;
1117 | return b;
1118 | } else {
1119 | return (com.google.protobuf.ByteString) ref;
1120 | }
1121 | }
1122 | /**
1123 | * required string userName = 2;
1124 | */
1125 | public Builder setUserName(
1126 | java.lang.String value) {
1127 | if (value == null) {
1128 | throw new NullPointerException();
1129 | }
1130 | bitField0_ |= 0x00000002;
1131 | userName_ = value;
1132 | onChanged();
1133 | return this;
1134 | }
1135 | /**
1136 | * required string userName = 2;
1137 | */
1138 | public Builder clearUserName() {
1139 | bitField0_ = (bitField0_ & ~0x00000002);
1140 | userName_ = getDefaultInstance().getUserName();
1141 | onChanged();
1142 | return this;
1143 | }
1144 | /**
1145 | * required string userName = 2;
1146 | */
1147 | public Builder setUserNameBytes(
1148 | com.google.protobuf.ByteString value) {
1149 | if (value == null) {
1150 | throw new NullPointerException();
1151 | }
1152 | bitField0_ |= 0x00000002;
1153 | userName_ = value;
1154 | onChanged();
1155 | return this;
1156 | }
1157 |
1158 | // required string userPwd = 3;
1159 | private java.lang.Object userPwd_ = "";
1160 | /**
1161 | * required string userPwd = 3;
1162 | */
1163 | public boolean hasUserPwd() {
1164 | return ((bitField0_ & 0x00000004) == 0x00000004);
1165 | }
1166 | /**
1167 | * required string userPwd = 3;
1168 | */
1169 | public java.lang.String getUserPwd() {
1170 | java.lang.Object ref = userPwd_;
1171 | if (!(ref instanceof java.lang.String)) {
1172 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
1173 | .toStringUtf8();
1174 | userPwd_ = s;
1175 | return s;
1176 | } else {
1177 | return (java.lang.String) ref;
1178 | }
1179 | }
1180 | /**
1181 | * required string userPwd = 3;
1182 | */
1183 | public com.google.protobuf.ByteString
1184 | getUserPwdBytes() {
1185 | java.lang.Object ref = userPwd_;
1186 | if (ref instanceof String) {
1187 | com.google.protobuf.ByteString b =
1188 | com.google.protobuf.ByteString.copyFromUtf8(
1189 | (java.lang.String) ref);
1190 | userPwd_ = b;
1191 | return b;
1192 | } else {
1193 | return (com.google.protobuf.ByteString) ref;
1194 | }
1195 | }
1196 | /**
1197 | * required string userPwd = 3;
1198 | */
1199 | public Builder setUserPwd(
1200 | java.lang.String value) {
1201 | if (value == null) {
1202 | throw new NullPointerException();
1203 | }
1204 | bitField0_ |= 0x00000004;
1205 | userPwd_ = value;
1206 | onChanged();
1207 | return this;
1208 | }
1209 | /**
1210 | * required string userPwd = 3;
1211 | */
1212 | public Builder clearUserPwd() {
1213 | bitField0_ = (bitField0_ & ~0x00000004);
1214 | userPwd_ = getDefaultInstance().getUserPwd();
1215 | onChanged();
1216 | return this;
1217 | }
1218 | /**
1219 | * required string userPwd = 3;
1220 | */
1221 | public Builder setUserPwdBytes(
1222 | com.google.protobuf.ByteString value) {
1223 | if (value == null) {
1224 | throw new NullPointerException();
1225 | }
1226 | bitField0_ |= 0x00000004;
1227 | userPwd_ = value;
1228 | onChanged();
1229 | return this;
1230 | }
1231 |
1232 | // @@protoc_insertion_point(builder_scope:Group.User)
1233 | }
1234 |
1235 | static {
1236 | defaultInstance = new User(true);
1237 | defaultInstance.initFields();
1238 | }
1239 |
1240 | // @@protoc_insertion_point(class_scope:Group.User)
1241 | }
1242 |
1243 | private int bitField0_;
1244 | // required .MsgEnum msgEnum = 1;
1245 | public static final int MSGENUM_FIELD_NUMBER = 1;
1246 | private com.drdg.netty.bean.InformationPacket.MsgEnum msgEnum_;
1247 | /**
1248 | * required .MsgEnum msgEnum = 1;
1249 | */
1250 | public boolean hasMsgEnum() {
1251 | return ((bitField0_ & 0x00000001) == 0x00000001);
1252 | }
1253 | /**
1254 | * required .MsgEnum msgEnum = 1;
1255 | */
1256 | public com.drdg.netty.bean.InformationPacket.MsgEnum getMsgEnum() {
1257 | return msgEnum_;
1258 | }
1259 |
1260 | // required .Login login = 2;
1261 | public static final int LOGIN_FIELD_NUMBER = 2;
1262 | private com.drdg.netty.bean.InformationPacket.Login login_;
1263 | /**
1264 | * required .Login login = 2;
1265 | */
1266 | public boolean hasLogin() {
1267 | return ((bitField0_ & 0x00000002) == 0x00000002);
1268 | }
1269 | /**
1270 | * required .Login login = 2;
1271 | */
1272 | public com.drdg.netty.bean.InformationPacket.Login getLogin() {
1273 | return login_;
1274 | }
1275 | /**
1276 | * required .Login login = 2;
1277 | */
1278 | public com.drdg.netty.bean.InformationPacket.LoginOrBuilder getLoginOrBuilder() {
1279 | return login_;
1280 | }
1281 |
1282 | // required .MsgInfo msgInfo = 3;
1283 | public static final int MSGINFO_FIELD_NUMBER = 3;
1284 | private com.drdg.netty.bean.InformationPacket.MsgInfo msgInfo_;
1285 | /**
1286 | * required .MsgInfo msgInfo = 3;
1287 | */
1288 | public boolean hasMsgInfo() {
1289 | return ((bitField0_ & 0x00000004) == 0x00000004);
1290 | }
1291 | /**
1292 | * required .MsgInfo msgInfo = 3;
1293 | */
1294 | public com.drdg.netty.bean.InformationPacket.MsgInfo getMsgInfo() {
1295 | return msgInfo_;
1296 | }
1297 | /**
1298 | * required .MsgInfo msgInfo = 3;
1299 | */
1300 | public com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder getMsgInfoOrBuilder() {
1301 | return msgInfo_;
1302 | }
1303 |
1304 | // required .Group.ServerConnectEnum serverConnectEnum = 4;
1305 | public static final int SERVERCONNECTENUM_FIELD_NUMBER = 4;
1306 | private com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum serverConnectEnum_;
1307 | /**
1308 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
1309 | */
1310 | public boolean hasServerConnectEnum() {
1311 | return ((bitField0_ & 0x00000008) == 0x00000008);
1312 | }
1313 | /**
1314 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
1315 | */
1316 | public com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum getServerConnectEnum() {
1317 | return serverConnectEnum_;
1318 | }
1319 |
1320 | // repeated .Group.User userList = 5;
1321 | public static final int USERLIST_FIELD_NUMBER = 5;
1322 | private java.util.List userList_;
1323 | /**
1324 | * repeated .Group.User userList = 5;
1325 | */
1326 | public java.util.List getUserListList() {
1327 | return userList_;
1328 | }
1329 | /**
1330 | * repeated .Group.User userList = 5;
1331 | */
1332 | public java.util.List extends com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder>
1333 | getUserListOrBuilderList() {
1334 | return userList_;
1335 | }
1336 | /**
1337 | * repeated .Group.User userList = 5;
1338 | */
1339 | public int getUserListCount() {
1340 | return userList_.size();
1341 | }
1342 | /**
1343 | * repeated .Group.User userList = 5;
1344 | */
1345 | public com.drdg.netty.bean.InformationPacket.Group.User getUserList(int index) {
1346 | return userList_.get(index);
1347 | }
1348 | /**
1349 | * repeated .Group.User userList = 5;
1350 | */
1351 | public com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder getUserListOrBuilder(
1352 | int index) {
1353 | return userList_.get(index);
1354 | }
1355 |
1356 | private void initFields() {
1357 | msgEnum_ = com.drdg.netty.bean.InformationPacket.MsgEnum.ReuqestToConnect;
1358 | login_ = com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance();
1359 | msgInfo_ = com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance();
1360 | serverConnectEnum_ = com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum.Request;
1361 | userList_ = java.util.Collections.emptyList();
1362 | }
1363 | private byte memoizedIsInitialized = -1;
1364 | public final boolean isInitialized() {
1365 | byte isInitialized = memoizedIsInitialized;
1366 | if (isInitialized != -1) return isInitialized == 1;
1367 |
1368 | if (!hasMsgEnum()) {
1369 | memoizedIsInitialized = 0;
1370 | return false;
1371 | }
1372 | if (!hasLogin()) {
1373 | memoizedIsInitialized = 0;
1374 | return false;
1375 | }
1376 | if (!hasMsgInfo()) {
1377 | memoizedIsInitialized = 0;
1378 | return false;
1379 | }
1380 | if (!hasServerConnectEnum()) {
1381 | memoizedIsInitialized = 0;
1382 | return false;
1383 | }
1384 | if (!getLogin().isInitialized()) {
1385 | memoizedIsInitialized = 0;
1386 | return false;
1387 | }
1388 | if (!getMsgInfo().isInitialized()) {
1389 | memoizedIsInitialized = 0;
1390 | return false;
1391 | }
1392 | for (int i = 0; i < getUserListCount(); i++) {
1393 | if (!getUserList(i).isInitialized()) {
1394 | memoizedIsInitialized = 0;
1395 | return false;
1396 | }
1397 | }
1398 | memoizedIsInitialized = 1;
1399 | return true;
1400 | }
1401 |
1402 | public void writeTo(com.google.protobuf.CodedOutputStream output)
1403 | throws java.io.IOException {
1404 | getSerializedSize();
1405 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
1406 | output.writeEnum(1, msgEnum_.getNumber());
1407 | }
1408 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
1409 | output.writeMessage(2, login_);
1410 | }
1411 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
1412 | output.writeMessage(3, msgInfo_);
1413 | }
1414 | if (((bitField0_ & 0x00000008) == 0x00000008)) {
1415 | output.writeEnum(4, serverConnectEnum_.getNumber());
1416 | }
1417 | for (int i = 0; i < userList_.size(); i++) {
1418 | output.writeMessage(5, userList_.get(i));
1419 | }
1420 | getUnknownFields().writeTo(output);
1421 | }
1422 |
1423 | private int memoizedSerializedSize = -1;
1424 | public int getSerializedSize() {
1425 | int size = memoizedSerializedSize;
1426 | if (size != -1) return size;
1427 |
1428 | size = 0;
1429 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
1430 | size += com.google.protobuf.CodedOutputStream
1431 | .computeEnumSize(1, msgEnum_.getNumber());
1432 | }
1433 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
1434 | size += com.google.protobuf.CodedOutputStream
1435 | .computeMessageSize(2, login_);
1436 | }
1437 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
1438 | size += com.google.protobuf.CodedOutputStream
1439 | .computeMessageSize(3, msgInfo_);
1440 | }
1441 | if (((bitField0_ & 0x00000008) == 0x00000008)) {
1442 | size += com.google.protobuf.CodedOutputStream
1443 | .computeEnumSize(4, serverConnectEnum_.getNumber());
1444 | }
1445 | for (int i = 0; i < userList_.size(); i++) {
1446 | size += com.google.protobuf.CodedOutputStream
1447 | .computeMessageSize(5, userList_.get(i));
1448 | }
1449 | size += getUnknownFields().getSerializedSize();
1450 | memoizedSerializedSize = size;
1451 | return size;
1452 | }
1453 |
1454 | private static final long serialVersionUID = 0L;
1455 | @java.lang.Override
1456 | protected java.lang.Object writeReplace()
1457 | throws java.io.ObjectStreamException {
1458 | return super.writeReplace();
1459 | }
1460 |
1461 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(
1462 | com.google.protobuf.ByteString data)
1463 | throws com.google.protobuf.InvalidProtocolBufferException {
1464 | return PARSER.parseFrom(data);
1465 | }
1466 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(
1467 | com.google.protobuf.ByteString data,
1468 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1469 | throws com.google.protobuf.InvalidProtocolBufferException {
1470 | return PARSER.parseFrom(data, extensionRegistry);
1471 | }
1472 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(byte[] data)
1473 | throws com.google.protobuf.InvalidProtocolBufferException {
1474 | return PARSER.parseFrom(data);
1475 | }
1476 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(
1477 | byte[] data,
1478 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1479 | throws com.google.protobuf.InvalidProtocolBufferException {
1480 | return PARSER.parseFrom(data, extensionRegistry);
1481 | }
1482 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(java.io.InputStream input)
1483 | throws java.io.IOException {
1484 | return PARSER.parseFrom(input);
1485 | }
1486 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(
1487 | java.io.InputStream input,
1488 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1489 | throws java.io.IOException {
1490 | return PARSER.parseFrom(input, extensionRegistry);
1491 | }
1492 | public static com.drdg.netty.bean.InformationPacket.Group parseDelimitedFrom(java.io.InputStream input)
1493 | throws java.io.IOException {
1494 | return PARSER.parseDelimitedFrom(input);
1495 | }
1496 | public static com.drdg.netty.bean.InformationPacket.Group parseDelimitedFrom(
1497 | java.io.InputStream input,
1498 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1499 | throws java.io.IOException {
1500 | return PARSER.parseDelimitedFrom(input, extensionRegistry);
1501 | }
1502 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(
1503 | com.google.protobuf.CodedInputStream input)
1504 | throws java.io.IOException {
1505 | return PARSER.parseFrom(input);
1506 | }
1507 | public static com.drdg.netty.bean.InformationPacket.Group parseFrom(
1508 | com.google.protobuf.CodedInputStream input,
1509 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1510 | throws java.io.IOException {
1511 | return PARSER.parseFrom(input, extensionRegistry);
1512 | }
1513 |
1514 | public static Builder newBuilder() { return Builder.create(); }
1515 | public Builder newBuilderForType() { return newBuilder(); }
1516 | public static Builder newBuilder(com.drdg.netty.bean.InformationPacket.Group prototype) {
1517 | return newBuilder().mergeFrom(prototype);
1518 | }
1519 | public Builder toBuilder() { return newBuilder(this); }
1520 |
1521 | @java.lang.Override
1522 | protected Builder newBuilderForType(
1523 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
1524 | Builder builder = new Builder(parent);
1525 | return builder;
1526 | }
1527 | /**
1528 | * Protobuf type {@code Group}
1529 | */
1530 | public static final class Builder extends
1531 | com.google.protobuf.GeneratedMessage.Builder
1532 | implements com.drdg.netty.bean.InformationPacket.GroupOrBuilder {
1533 | public static final com.google.protobuf.Descriptors.Descriptor
1534 | getDescriptor() {
1535 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_descriptor;
1536 | }
1537 |
1538 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
1539 | internalGetFieldAccessorTable() {
1540 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_fieldAccessorTable
1541 | .ensureFieldAccessorsInitialized(
1542 | com.drdg.netty.bean.InformationPacket.Group.class, com.drdg.netty.bean.InformationPacket.Group.Builder.class);
1543 | }
1544 |
1545 | // Construct using com.drdg.netty.bean.InformationPacket.Group.newBuilder()
1546 | private Builder() {
1547 | maybeForceBuilderInitialization();
1548 | }
1549 |
1550 | private Builder(
1551 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
1552 | super(parent);
1553 | maybeForceBuilderInitialization();
1554 | }
1555 | private void maybeForceBuilderInitialization() {
1556 | if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
1557 | getLoginFieldBuilder();
1558 | getMsgInfoFieldBuilder();
1559 | getUserListFieldBuilder();
1560 | }
1561 | }
1562 | private static Builder create() {
1563 | return new Builder();
1564 | }
1565 |
1566 | public Builder clear() {
1567 | super.clear();
1568 | msgEnum_ = com.drdg.netty.bean.InformationPacket.MsgEnum.ReuqestToConnect;
1569 | bitField0_ = (bitField0_ & ~0x00000001);
1570 | if (loginBuilder_ == null) {
1571 | login_ = com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance();
1572 | } else {
1573 | loginBuilder_.clear();
1574 | }
1575 | bitField0_ = (bitField0_ & ~0x00000002);
1576 | if (msgInfoBuilder_ == null) {
1577 | msgInfo_ = com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance();
1578 | } else {
1579 | msgInfoBuilder_.clear();
1580 | }
1581 | bitField0_ = (bitField0_ & ~0x00000004);
1582 | serverConnectEnum_ = com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum.Request;
1583 | bitField0_ = (bitField0_ & ~0x00000008);
1584 | if (userListBuilder_ == null) {
1585 | userList_ = java.util.Collections.emptyList();
1586 | bitField0_ = (bitField0_ & ~0x00000010);
1587 | } else {
1588 | userListBuilder_.clear();
1589 | }
1590 | return this;
1591 | }
1592 |
1593 | public Builder clone() {
1594 | return create().mergeFrom(buildPartial());
1595 | }
1596 |
1597 | public com.google.protobuf.Descriptors.Descriptor
1598 | getDescriptorForType() {
1599 | return com.drdg.netty.bean.InformationPacket.internal_static_Group_descriptor;
1600 | }
1601 |
1602 | public com.drdg.netty.bean.InformationPacket.Group getDefaultInstanceForType() {
1603 | return com.drdg.netty.bean.InformationPacket.Group.getDefaultInstance();
1604 | }
1605 |
1606 | public com.drdg.netty.bean.InformationPacket.Group build() {
1607 | com.drdg.netty.bean.InformationPacket.Group result = buildPartial();
1608 | if (!result.isInitialized()) {
1609 | throw newUninitializedMessageException(result);
1610 | }
1611 | return result;
1612 | }
1613 |
1614 | public com.drdg.netty.bean.InformationPacket.Group buildPartial() {
1615 | com.drdg.netty.bean.InformationPacket.Group result = new com.drdg.netty.bean.InformationPacket.Group(this);
1616 | int from_bitField0_ = bitField0_;
1617 | int to_bitField0_ = 0;
1618 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
1619 | to_bitField0_ |= 0x00000001;
1620 | }
1621 | result.msgEnum_ = msgEnum_;
1622 | if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
1623 | to_bitField0_ |= 0x00000002;
1624 | }
1625 | if (loginBuilder_ == null) {
1626 | result.login_ = login_;
1627 | } else {
1628 | result.login_ = loginBuilder_.build();
1629 | }
1630 | if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
1631 | to_bitField0_ |= 0x00000004;
1632 | }
1633 | if (msgInfoBuilder_ == null) {
1634 | result.msgInfo_ = msgInfo_;
1635 | } else {
1636 | result.msgInfo_ = msgInfoBuilder_.build();
1637 | }
1638 | if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
1639 | to_bitField0_ |= 0x00000008;
1640 | }
1641 | result.serverConnectEnum_ = serverConnectEnum_;
1642 | if (userListBuilder_ == null) {
1643 | if (((bitField0_ & 0x00000010) == 0x00000010)) {
1644 | userList_ = java.util.Collections.unmodifiableList(userList_);
1645 | bitField0_ = (bitField0_ & ~0x00000010);
1646 | }
1647 | result.userList_ = userList_;
1648 | } else {
1649 | result.userList_ = userListBuilder_.build();
1650 | }
1651 | result.bitField0_ = to_bitField0_;
1652 | onBuilt();
1653 | return result;
1654 | }
1655 |
1656 | public Builder mergeFrom(com.google.protobuf.Message other) {
1657 | if (other instanceof com.drdg.netty.bean.InformationPacket.Group) {
1658 | return mergeFrom((com.drdg.netty.bean.InformationPacket.Group)other);
1659 | } else {
1660 | super.mergeFrom(other);
1661 | return this;
1662 | }
1663 | }
1664 |
1665 | public Builder mergeFrom(com.drdg.netty.bean.InformationPacket.Group other) {
1666 | if (other == com.drdg.netty.bean.InformationPacket.Group.getDefaultInstance()) return this;
1667 | if (other.hasMsgEnum()) {
1668 | setMsgEnum(other.getMsgEnum());
1669 | }
1670 | if (other.hasLogin()) {
1671 | mergeLogin(other.getLogin());
1672 | }
1673 | if (other.hasMsgInfo()) {
1674 | mergeMsgInfo(other.getMsgInfo());
1675 | }
1676 | if (other.hasServerConnectEnum()) {
1677 | setServerConnectEnum(other.getServerConnectEnum());
1678 | }
1679 | if (userListBuilder_ == null) {
1680 | if (!other.userList_.isEmpty()) {
1681 | if (userList_.isEmpty()) {
1682 | userList_ = other.userList_;
1683 | bitField0_ = (bitField0_ & ~0x00000010);
1684 | } else {
1685 | ensureUserListIsMutable();
1686 | userList_.addAll(other.userList_);
1687 | }
1688 | onChanged();
1689 | }
1690 | } else {
1691 | if (!other.userList_.isEmpty()) {
1692 | if (userListBuilder_.isEmpty()) {
1693 | userListBuilder_.dispose();
1694 | userListBuilder_ = null;
1695 | userList_ = other.userList_;
1696 | bitField0_ = (bitField0_ & ~0x00000010);
1697 | userListBuilder_ =
1698 | com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
1699 | getUserListFieldBuilder() : null;
1700 | } else {
1701 | userListBuilder_.addAllMessages(other.userList_);
1702 | }
1703 | }
1704 | }
1705 | this.mergeUnknownFields(other.getUnknownFields());
1706 | return this;
1707 | }
1708 |
1709 | public final boolean isInitialized() {
1710 | if (!hasMsgEnum()) {
1711 |
1712 | return false;
1713 | }
1714 | if (!hasLogin()) {
1715 |
1716 | return false;
1717 | }
1718 | if (!hasMsgInfo()) {
1719 |
1720 | return false;
1721 | }
1722 | if (!hasServerConnectEnum()) {
1723 |
1724 | return false;
1725 | }
1726 | if (!getLogin().isInitialized()) {
1727 |
1728 | return false;
1729 | }
1730 | if (!getMsgInfo().isInitialized()) {
1731 |
1732 | return false;
1733 | }
1734 | for (int i = 0; i < getUserListCount(); i++) {
1735 | if (!getUserList(i).isInitialized()) {
1736 |
1737 | return false;
1738 | }
1739 | }
1740 | return true;
1741 | }
1742 |
1743 | public Builder mergeFrom(
1744 | com.google.protobuf.CodedInputStream input,
1745 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
1746 | throws java.io.IOException {
1747 | com.drdg.netty.bean.InformationPacket.Group parsedMessage = null;
1748 | try {
1749 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
1750 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
1751 | parsedMessage = (com.drdg.netty.bean.InformationPacket.Group) e.getUnfinishedMessage();
1752 | throw e;
1753 | } finally {
1754 | if (parsedMessage != null) {
1755 | mergeFrom(parsedMessage);
1756 | }
1757 | }
1758 | return this;
1759 | }
1760 | private int bitField0_;
1761 |
1762 | // required .MsgEnum msgEnum = 1;
1763 | private com.drdg.netty.bean.InformationPacket.MsgEnum msgEnum_ = com.drdg.netty.bean.InformationPacket.MsgEnum.ReuqestToConnect;
1764 | /**
1765 | * required .MsgEnum msgEnum = 1;
1766 | */
1767 | public boolean hasMsgEnum() {
1768 | return ((bitField0_ & 0x00000001) == 0x00000001);
1769 | }
1770 | /**
1771 | * required .MsgEnum msgEnum = 1;
1772 | */
1773 | public com.drdg.netty.bean.InformationPacket.MsgEnum getMsgEnum() {
1774 | return msgEnum_;
1775 | }
1776 | /**
1777 | * required .MsgEnum msgEnum = 1;
1778 | */
1779 | public Builder setMsgEnum(com.drdg.netty.bean.InformationPacket.MsgEnum value) {
1780 | if (value == null) {
1781 | throw new NullPointerException();
1782 | }
1783 | bitField0_ |= 0x00000001;
1784 | msgEnum_ = value;
1785 | onChanged();
1786 | return this;
1787 | }
1788 | /**
1789 | * required .MsgEnum msgEnum = 1;
1790 | */
1791 | public Builder clearMsgEnum() {
1792 | bitField0_ = (bitField0_ & ~0x00000001);
1793 | msgEnum_ = com.drdg.netty.bean.InformationPacket.MsgEnum.ReuqestToConnect;
1794 | onChanged();
1795 | return this;
1796 | }
1797 |
1798 | // required .Login login = 2;
1799 | private com.drdg.netty.bean.InformationPacket.Login login_ = com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance();
1800 | private com.google.protobuf.SingleFieldBuilder<
1801 | com.drdg.netty.bean.InformationPacket.Login, com.drdg.netty.bean.InformationPacket.Login.Builder, com.drdg.netty.bean.InformationPacket.LoginOrBuilder> loginBuilder_;
1802 | /**
1803 | * required .Login login = 2;
1804 | */
1805 | public boolean hasLogin() {
1806 | return ((bitField0_ & 0x00000002) == 0x00000002);
1807 | }
1808 | /**
1809 | * required .Login login = 2;
1810 | */
1811 | public com.drdg.netty.bean.InformationPacket.Login getLogin() {
1812 | if (loginBuilder_ == null) {
1813 | return login_;
1814 | } else {
1815 | return loginBuilder_.getMessage();
1816 | }
1817 | }
1818 | /**
1819 | * required .Login login = 2;
1820 | */
1821 | public Builder setLogin(com.drdg.netty.bean.InformationPacket.Login value) {
1822 | if (loginBuilder_ == null) {
1823 | if (value == null) {
1824 | throw new NullPointerException();
1825 | }
1826 | login_ = value;
1827 | onChanged();
1828 | } else {
1829 | loginBuilder_.setMessage(value);
1830 | }
1831 | bitField0_ |= 0x00000002;
1832 | return this;
1833 | }
1834 | /**
1835 | * required .Login login = 2;
1836 | */
1837 | public Builder setLogin(
1838 | com.drdg.netty.bean.InformationPacket.Login.Builder builderForValue) {
1839 | if (loginBuilder_ == null) {
1840 | login_ = builderForValue.build();
1841 | onChanged();
1842 | } else {
1843 | loginBuilder_.setMessage(builderForValue.build());
1844 | }
1845 | bitField0_ |= 0x00000002;
1846 | return this;
1847 | }
1848 | /**
1849 | * required .Login login = 2;
1850 | */
1851 | public Builder mergeLogin(com.drdg.netty.bean.InformationPacket.Login value) {
1852 | if (loginBuilder_ == null) {
1853 | if (((bitField0_ & 0x00000002) == 0x00000002) &&
1854 | login_ != com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance()) {
1855 | login_ =
1856 | com.drdg.netty.bean.InformationPacket.Login.newBuilder(login_).mergeFrom(value).buildPartial();
1857 | } else {
1858 | login_ = value;
1859 | }
1860 | onChanged();
1861 | } else {
1862 | loginBuilder_.mergeFrom(value);
1863 | }
1864 | bitField0_ |= 0x00000002;
1865 | return this;
1866 | }
1867 | /**
1868 | * required .Login login = 2;
1869 | */
1870 | public Builder clearLogin() {
1871 | if (loginBuilder_ == null) {
1872 | login_ = com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance();
1873 | onChanged();
1874 | } else {
1875 | loginBuilder_.clear();
1876 | }
1877 | bitField0_ = (bitField0_ & ~0x00000002);
1878 | return this;
1879 | }
1880 | /**
1881 | * required .Login login = 2;
1882 | */
1883 | public com.drdg.netty.bean.InformationPacket.Login.Builder getLoginBuilder() {
1884 | bitField0_ |= 0x00000002;
1885 | onChanged();
1886 | return getLoginFieldBuilder().getBuilder();
1887 | }
1888 | /**
1889 | * required .Login login = 2;
1890 | */
1891 | public com.drdg.netty.bean.InformationPacket.LoginOrBuilder getLoginOrBuilder() {
1892 | if (loginBuilder_ != null) {
1893 | return loginBuilder_.getMessageOrBuilder();
1894 | } else {
1895 | return login_;
1896 | }
1897 | }
1898 | /**
1899 | * required .Login login = 2;
1900 | */
1901 | private com.google.protobuf.SingleFieldBuilder<
1902 | com.drdg.netty.bean.InformationPacket.Login, com.drdg.netty.bean.InformationPacket.Login.Builder, com.drdg.netty.bean.InformationPacket.LoginOrBuilder>
1903 | getLoginFieldBuilder() {
1904 | if (loginBuilder_ == null) {
1905 | loginBuilder_ = new com.google.protobuf.SingleFieldBuilder<
1906 | com.drdg.netty.bean.InformationPacket.Login, com.drdg.netty.bean.InformationPacket.Login.Builder, com.drdg.netty.bean.InformationPacket.LoginOrBuilder>(
1907 | login_,
1908 | getParentForChildren(),
1909 | isClean());
1910 | login_ = null;
1911 | }
1912 | return loginBuilder_;
1913 | }
1914 |
1915 | // required .MsgInfo msgInfo = 3;
1916 | private com.drdg.netty.bean.InformationPacket.MsgInfo msgInfo_ = com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance();
1917 | private com.google.protobuf.SingleFieldBuilder<
1918 | com.drdg.netty.bean.InformationPacket.MsgInfo, com.drdg.netty.bean.InformationPacket.MsgInfo.Builder, com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder> msgInfoBuilder_;
1919 | /**
1920 | * required .MsgInfo msgInfo = 3;
1921 | */
1922 | public boolean hasMsgInfo() {
1923 | return ((bitField0_ & 0x00000004) == 0x00000004);
1924 | }
1925 | /**
1926 | * required .MsgInfo msgInfo = 3;
1927 | */
1928 | public com.drdg.netty.bean.InformationPacket.MsgInfo getMsgInfo() {
1929 | if (msgInfoBuilder_ == null) {
1930 | return msgInfo_;
1931 | } else {
1932 | return msgInfoBuilder_.getMessage();
1933 | }
1934 | }
1935 | /**
1936 | * required .MsgInfo msgInfo = 3;
1937 | */
1938 | public Builder setMsgInfo(com.drdg.netty.bean.InformationPacket.MsgInfo value) {
1939 | if (msgInfoBuilder_ == null) {
1940 | if (value == null) {
1941 | throw new NullPointerException();
1942 | }
1943 | msgInfo_ = value;
1944 | onChanged();
1945 | } else {
1946 | msgInfoBuilder_.setMessage(value);
1947 | }
1948 | bitField0_ |= 0x00000004;
1949 | return this;
1950 | }
1951 | /**
1952 | * required .MsgInfo msgInfo = 3;
1953 | */
1954 | public Builder setMsgInfo(
1955 | com.drdg.netty.bean.InformationPacket.MsgInfo.Builder builderForValue) {
1956 | if (msgInfoBuilder_ == null) {
1957 | msgInfo_ = builderForValue.build();
1958 | onChanged();
1959 | } else {
1960 | msgInfoBuilder_.setMessage(builderForValue.build());
1961 | }
1962 | bitField0_ |= 0x00000004;
1963 | return this;
1964 | }
1965 | /**
1966 | * required .MsgInfo msgInfo = 3;
1967 | */
1968 | public Builder mergeMsgInfo(com.drdg.netty.bean.InformationPacket.MsgInfo value) {
1969 | if (msgInfoBuilder_ == null) {
1970 | if (((bitField0_ & 0x00000004) == 0x00000004) &&
1971 | msgInfo_ != com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance()) {
1972 | msgInfo_ =
1973 | com.drdg.netty.bean.InformationPacket.MsgInfo.newBuilder(msgInfo_).mergeFrom(value).buildPartial();
1974 | } else {
1975 | msgInfo_ = value;
1976 | }
1977 | onChanged();
1978 | } else {
1979 | msgInfoBuilder_.mergeFrom(value);
1980 | }
1981 | bitField0_ |= 0x00000004;
1982 | return this;
1983 | }
1984 | /**
1985 | * required .MsgInfo msgInfo = 3;
1986 | */
1987 | public Builder clearMsgInfo() {
1988 | if (msgInfoBuilder_ == null) {
1989 | msgInfo_ = com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance();
1990 | onChanged();
1991 | } else {
1992 | msgInfoBuilder_.clear();
1993 | }
1994 | bitField0_ = (bitField0_ & ~0x00000004);
1995 | return this;
1996 | }
1997 | /**
1998 | * required .MsgInfo msgInfo = 3;
1999 | */
2000 | public com.drdg.netty.bean.InformationPacket.MsgInfo.Builder getMsgInfoBuilder() {
2001 | bitField0_ |= 0x00000004;
2002 | onChanged();
2003 | return getMsgInfoFieldBuilder().getBuilder();
2004 | }
2005 | /**
2006 | * required .MsgInfo msgInfo = 3;
2007 | */
2008 | public com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder getMsgInfoOrBuilder() {
2009 | if (msgInfoBuilder_ != null) {
2010 | return msgInfoBuilder_.getMessageOrBuilder();
2011 | } else {
2012 | return msgInfo_;
2013 | }
2014 | }
2015 | /**
2016 | * required .MsgInfo msgInfo = 3;
2017 | */
2018 | private com.google.protobuf.SingleFieldBuilder<
2019 | com.drdg.netty.bean.InformationPacket.MsgInfo, com.drdg.netty.bean.InformationPacket.MsgInfo.Builder, com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder>
2020 | getMsgInfoFieldBuilder() {
2021 | if (msgInfoBuilder_ == null) {
2022 | msgInfoBuilder_ = new com.google.protobuf.SingleFieldBuilder<
2023 | com.drdg.netty.bean.InformationPacket.MsgInfo, com.drdg.netty.bean.InformationPacket.MsgInfo.Builder, com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder>(
2024 | msgInfo_,
2025 | getParentForChildren(),
2026 | isClean());
2027 | msgInfo_ = null;
2028 | }
2029 | return msgInfoBuilder_;
2030 | }
2031 |
2032 | // required .Group.ServerConnectEnum serverConnectEnum = 4;
2033 | private com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum serverConnectEnum_ = com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum.Request;
2034 | /**
2035 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
2036 | */
2037 | public boolean hasServerConnectEnum() {
2038 | return ((bitField0_ & 0x00000008) == 0x00000008);
2039 | }
2040 | /**
2041 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
2042 | */
2043 | public com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum getServerConnectEnum() {
2044 | return serverConnectEnum_;
2045 | }
2046 | /**
2047 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
2048 | */
2049 | public Builder setServerConnectEnum(com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum value) {
2050 | if (value == null) {
2051 | throw new NullPointerException();
2052 | }
2053 | bitField0_ |= 0x00000008;
2054 | serverConnectEnum_ = value;
2055 | onChanged();
2056 | return this;
2057 | }
2058 | /**
2059 | * required .Group.ServerConnectEnum serverConnectEnum = 4;
2060 | */
2061 | public Builder clearServerConnectEnum() {
2062 | bitField0_ = (bitField0_ & ~0x00000008);
2063 | serverConnectEnum_ = com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum.Request;
2064 | onChanged();
2065 | return this;
2066 | }
2067 |
2068 | // repeated .Group.User userList = 5;
2069 | private java.util.List userList_ =
2070 | java.util.Collections.emptyList();
2071 | private void ensureUserListIsMutable() {
2072 | if (!((bitField0_ & 0x00000010) == 0x00000010)) {
2073 | userList_ = new java.util.ArrayList(userList_);
2074 | bitField0_ |= 0x00000010;
2075 | }
2076 | }
2077 |
2078 | private com.google.protobuf.RepeatedFieldBuilder<
2079 | com.drdg.netty.bean.InformationPacket.Group.User, com.drdg.netty.bean.InformationPacket.Group.User.Builder, com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder> userListBuilder_;
2080 |
2081 | /**
2082 | * repeated .Group.User userList = 5;
2083 | */
2084 | public java.util.List getUserListList() {
2085 | if (userListBuilder_ == null) {
2086 | return java.util.Collections.unmodifiableList(userList_);
2087 | } else {
2088 | return userListBuilder_.getMessageList();
2089 | }
2090 | }
2091 | /**
2092 | * repeated .Group.User userList = 5;
2093 | */
2094 | public int getUserListCount() {
2095 | if (userListBuilder_ == null) {
2096 | return userList_.size();
2097 | } else {
2098 | return userListBuilder_.getCount();
2099 | }
2100 | }
2101 | /**
2102 | * repeated .Group.User userList = 5;
2103 | */
2104 | public com.drdg.netty.bean.InformationPacket.Group.User getUserList(int index) {
2105 | if (userListBuilder_ == null) {
2106 | return userList_.get(index);
2107 | } else {
2108 | return userListBuilder_.getMessage(index);
2109 | }
2110 | }
2111 | /**
2112 | * repeated .Group.User userList = 5;
2113 | */
2114 | public Builder setUserList(
2115 | int index, com.drdg.netty.bean.InformationPacket.Group.User value) {
2116 | if (userListBuilder_ == null) {
2117 | if (value == null) {
2118 | throw new NullPointerException();
2119 | }
2120 | ensureUserListIsMutable();
2121 | userList_.set(index, value);
2122 | onChanged();
2123 | } else {
2124 | userListBuilder_.setMessage(index, value);
2125 | }
2126 | return this;
2127 | }
2128 | /**
2129 | * repeated .Group.User userList = 5;
2130 | */
2131 | public Builder setUserList(
2132 | int index, com.drdg.netty.bean.InformationPacket.Group.User.Builder builderForValue) {
2133 | if (userListBuilder_ == null) {
2134 | ensureUserListIsMutable();
2135 | userList_.set(index, builderForValue.build());
2136 | onChanged();
2137 | } else {
2138 | userListBuilder_.setMessage(index, builderForValue.build());
2139 | }
2140 | return this;
2141 | }
2142 | /**
2143 | * repeated .Group.User userList = 5;
2144 | */
2145 | public Builder addUserList(com.drdg.netty.bean.InformationPacket.Group.User value) {
2146 | if (userListBuilder_ == null) {
2147 | if (value == null) {
2148 | throw new NullPointerException();
2149 | }
2150 | ensureUserListIsMutable();
2151 | userList_.add(value);
2152 | onChanged();
2153 | } else {
2154 | userListBuilder_.addMessage(value);
2155 | }
2156 | return this;
2157 | }
2158 | /**
2159 | * repeated .Group.User userList = 5;
2160 | */
2161 | public Builder addUserList(
2162 | int index, com.drdg.netty.bean.InformationPacket.Group.User value) {
2163 | if (userListBuilder_ == null) {
2164 | if (value == null) {
2165 | throw new NullPointerException();
2166 | }
2167 | ensureUserListIsMutable();
2168 | userList_.add(index, value);
2169 | onChanged();
2170 | } else {
2171 | userListBuilder_.addMessage(index, value);
2172 | }
2173 | return this;
2174 | }
2175 | /**
2176 | * repeated .Group.User userList = 5;
2177 | */
2178 | public Builder addUserList(
2179 | com.drdg.netty.bean.InformationPacket.Group.User.Builder builderForValue) {
2180 | if (userListBuilder_ == null) {
2181 | ensureUserListIsMutable();
2182 | userList_.add(builderForValue.build());
2183 | onChanged();
2184 | } else {
2185 | userListBuilder_.addMessage(builderForValue.build());
2186 | }
2187 | return this;
2188 | }
2189 | /**
2190 | * repeated .Group.User userList = 5;
2191 | */
2192 | public Builder addUserList(
2193 | int index, com.drdg.netty.bean.InformationPacket.Group.User.Builder builderForValue) {
2194 | if (userListBuilder_ == null) {
2195 | ensureUserListIsMutable();
2196 | userList_.add(index, builderForValue.build());
2197 | onChanged();
2198 | } else {
2199 | userListBuilder_.addMessage(index, builderForValue.build());
2200 | }
2201 | return this;
2202 | }
2203 | /**
2204 | * repeated .Group.User userList = 5;
2205 | */
2206 | public Builder addAllUserList(
2207 | java.lang.Iterable extends com.drdg.netty.bean.InformationPacket.Group.User> values) {
2208 | if (userListBuilder_ == null) {
2209 | ensureUserListIsMutable();
2210 | super.addAll(values, userList_);
2211 | onChanged();
2212 | } else {
2213 | userListBuilder_.addAllMessages(values);
2214 | }
2215 | return this;
2216 | }
2217 | /**
2218 | * repeated .Group.User userList = 5;
2219 | */
2220 | public Builder clearUserList() {
2221 | if (userListBuilder_ == null) {
2222 | userList_ = java.util.Collections.emptyList();
2223 | bitField0_ = (bitField0_ & ~0x00000010);
2224 | onChanged();
2225 | } else {
2226 | userListBuilder_.clear();
2227 | }
2228 | return this;
2229 | }
2230 | /**
2231 | * repeated .Group.User userList = 5;
2232 | */
2233 | public Builder removeUserList(int index) {
2234 | if (userListBuilder_ == null) {
2235 | ensureUserListIsMutable();
2236 | userList_.remove(index);
2237 | onChanged();
2238 | } else {
2239 | userListBuilder_.remove(index);
2240 | }
2241 | return this;
2242 | }
2243 | /**
2244 | * repeated .Group.User userList = 5;
2245 | */
2246 | public com.drdg.netty.bean.InformationPacket.Group.User.Builder getUserListBuilder(
2247 | int index) {
2248 | return getUserListFieldBuilder().getBuilder(index);
2249 | }
2250 | /**
2251 | * repeated .Group.User userList = 5;
2252 | */
2253 | public com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder getUserListOrBuilder(
2254 | int index) {
2255 | if (userListBuilder_ == null) {
2256 | return userList_.get(index); } else {
2257 | return userListBuilder_.getMessageOrBuilder(index);
2258 | }
2259 | }
2260 | /**
2261 | * repeated .Group.User userList = 5;
2262 | */
2263 | public java.util.List extends com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder>
2264 | getUserListOrBuilderList() {
2265 | if (userListBuilder_ != null) {
2266 | return userListBuilder_.getMessageOrBuilderList();
2267 | } else {
2268 | return java.util.Collections.unmodifiableList(userList_);
2269 | }
2270 | }
2271 | /**
2272 | * repeated .Group.User userList = 5;
2273 | */
2274 | public com.drdg.netty.bean.InformationPacket.Group.User.Builder addUserListBuilder() {
2275 | return getUserListFieldBuilder().addBuilder(
2276 | com.drdg.netty.bean.InformationPacket.Group.User.getDefaultInstance());
2277 | }
2278 | /**
2279 | * repeated .Group.User userList = 5;
2280 | */
2281 | public com.drdg.netty.bean.InformationPacket.Group.User.Builder addUserListBuilder(
2282 | int index) {
2283 | return getUserListFieldBuilder().addBuilder(
2284 | index, com.drdg.netty.bean.InformationPacket.Group.User.getDefaultInstance());
2285 | }
2286 | /**
2287 | * repeated .Group.User userList = 5;
2288 | */
2289 | public java.util.List
2290 | getUserListBuilderList() {
2291 | return getUserListFieldBuilder().getBuilderList();
2292 | }
2293 | private com.google.protobuf.RepeatedFieldBuilder<
2294 | com.drdg.netty.bean.InformationPacket.Group.User, com.drdg.netty.bean.InformationPacket.Group.User.Builder, com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder>
2295 | getUserListFieldBuilder() {
2296 | if (userListBuilder_ == null) {
2297 | userListBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
2298 | com.drdg.netty.bean.InformationPacket.Group.User, com.drdg.netty.bean.InformationPacket.Group.User.Builder, com.drdg.netty.bean.InformationPacket.Group.UserOrBuilder>(
2299 | userList_,
2300 | ((bitField0_ & 0x00000010) == 0x00000010),
2301 | getParentForChildren(),
2302 | isClean());
2303 | userList_ = null;
2304 | }
2305 | return userListBuilder_;
2306 | }
2307 |
2308 | // @@protoc_insertion_point(builder_scope:Group)
2309 | }
2310 |
2311 | static {
2312 | defaultInstance = new Group(true);
2313 | defaultInstance.initFields();
2314 | }
2315 |
2316 | // @@protoc_insertion_point(class_scope:Group)
2317 | }
2318 |
2319 | public interface LoginOrBuilder
2320 | extends com.google.protobuf.MessageOrBuilder {
2321 |
2322 | // required string userName = 1;
2323 | /**
2324 | * required string userName = 1;
2325 | */
2326 | boolean hasUserName();
2327 | /**
2328 | * required string userName = 1;
2329 | */
2330 | java.lang.String getUserName();
2331 | /**
2332 | * required string userName = 1;
2333 | */
2334 | com.google.protobuf.ByteString
2335 | getUserNameBytes();
2336 |
2337 | // required string userPwd = 2;
2338 | /**
2339 | * required string userPwd = 2;
2340 | */
2341 | boolean hasUserPwd();
2342 | /**
2343 | * required string userPwd = 2;
2344 | */
2345 | java.lang.String getUserPwd();
2346 | /**
2347 | * required string userPwd = 2;
2348 | */
2349 | com.google.protobuf.ByteString
2350 | getUserPwdBytes();
2351 |
2352 | // required .Login.LoinEnum loginState = 3;
2353 | /**
2354 | * required .Login.LoinEnum loginState = 3;
2355 | */
2356 | boolean hasLoginState();
2357 | /**
2358 | * required .Login.LoinEnum loginState = 3;
2359 | */
2360 | com.drdg.netty.bean.InformationPacket.Login.LoinEnum getLoginState();
2361 |
2362 | // required string feedBackInfo = 4;
2363 | /**
2364 | * required string feedBackInfo = 4;
2365 | */
2366 | boolean hasFeedBackInfo();
2367 | /**
2368 | * required string feedBackInfo = 4;
2369 | */
2370 | java.lang.String getFeedBackInfo();
2371 | /**
2372 | * required string feedBackInfo = 4;
2373 | */
2374 | com.google.protobuf.ByteString
2375 | getFeedBackInfoBytes();
2376 | }
2377 | /**
2378 | * Protobuf type {@code Login}
2379 | */
2380 | public static final class Login extends
2381 | com.google.protobuf.GeneratedMessage
2382 | implements LoginOrBuilder {
2383 | // Use Login.newBuilder() to construct.
2384 | private Login(com.google.protobuf.GeneratedMessage.Builder> builder) {
2385 | super(builder);
2386 | this.unknownFields = builder.getUnknownFields();
2387 | }
2388 | private Login(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
2389 |
2390 | private static final Login defaultInstance;
2391 | public static Login getDefaultInstance() {
2392 | return defaultInstance;
2393 | }
2394 |
2395 | public Login getDefaultInstanceForType() {
2396 | return defaultInstance;
2397 | }
2398 |
2399 | private final com.google.protobuf.UnknownFieldSet unknownFields;
2400 | @java.lang.Override
2401 | public final com.google.protobuf.UnknownFieldSet
2402 | getUnknownFields() {
2403 | return this.unknownFields;
2404 | }
2405 | private Login(
2406 | com.google.protobuf.CodedInputStream input,
2407 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2408 | throws com.google.protobuf.InvalidProtocolBufferException {
2409 | initFields();
2410 | int mutable_bitField0_ = 0;
2411 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
2412 | com.google.protobuf.UnknownFieldSet.newBuilder();
2413 | try {
2414 | boolean done = false;
2415 | while (!done) {
2416 | int tag = input.readTag();
2417 | switch (tag) {
2418 | case 0:
2419 | done = true;
2420 | break;
2421 | default: {
2422 | if (!parseUnknownField(input, unknownFields,
2423 | extensionRegistry, tag)) {
2424 | done = true;
2425 | }
2426 | break;
2427 | }
2428 | case 10: {
2429 | bitField0_ |= 0x00000001;
2430 | userName_ = input.readBytes();
2431 | break;
2432 | }
2433 | case 18: {
2434 | bitField0_ |= 0x00000002;
2435 | userPwd_ = input.readBytes();
2436 | break;
2437 | }
2438 | case 24: {
2439 | int rawValue = input.readEnum();
2440 | com.drdg.netty.bean.InformationPacket.Login.LoinEnum value = com.drdg.netty.bean.InformationPacket.Login.LoinEnum.valueOf(rawValue);
2441 | if (value == null) {
2442 | unknownFields.mergeVarintField(3, rawValue);
2443 | } else {
2444 | bitField0_ |= 0x00000004;
2445 | loginState_ = value;
2446 | }
2447 | break;
2448 | }
2449 | case 34: {
2450 | bitField0_ |= 0x00000008;
2451 | feedBackInfo_ = input.readBytes();
2452 | break;
2453 | }
2454 | }
2455 | }
2456 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
2457 | throw e.setUnfinishedMessage(this);
2458 | } catch (java.io.IOException e) {
2459 | throw new com.google.protobuf.InvalidProtocolBufferException(
2460 | e.getMessage()).setUnfinishedMessage(this);
2461 | } finally {
2462 | this.unknownFields = unknownFields.build();
2463 | makeExtensionsImmutable();
2464 | }
2465 | }
2466 | public static final com.google.protobuf.Descriptors.Descriptor
2467 | getDescriptor() {
2468 | return com.drdg.netty.bean.InformationPacket.internal_static_Login_descriptor;
2469 | }
2470 |
2471 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
2472 | internalGetFieldAccessorTable() {
2473 | return com.drdg.netty.bean.InformationPacket.internal_static_Login_fieldAccessorTable
2474 | .ensureFieldAccessorsInitialized(
2475 | com.drdg.netty.bean.InformationPacket.Login.class, com.drdg.netty.bean.InformationPacket.Login.Builder.class);
2476 | }
2477 |
2478 | public static com.google.protobuf.Parser PARSER =
2479 | new com.google.protobuf.AbstractParser() {
2480 | public Login parsePartialFrom(
2481 | com.google.protobuf.CodedInputStream input,
2482 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2483 | throws com.google.protobuf.InvalidProtocolBufferException {
2484 | return new Login(input, extensionRegistry);
2485 | }
2486 | };
2487 |
2488 | @java.lang.Override
2489 | public com.google.protobuf.Parser getParserForType() {
2490 | return PARSER;
2491 | }
2492 |
2493 | /**
2494 | * Protobuf enum {@code Login.LoinEnum}
2495 | */
2496 | public enum LoinEnum
2497 | implements com.google.protobuf.ProtocolMessageEnum {
2498 | /**
2499 | * Request = 1;
2500 | */
2501 | Request(0, 1),
2502 | /**
2503 | * Success = 2;
2504 | */
2505 | Success(1, 2),
2506 | /**
2507 | * Failure = 3;
2508 | */
2509 | Failure(2, 3),
2510 | ;
2511 |
2512 | /**
2513 | * Request = 1;
2514 | */
2515 | public static final int Request_VALUE = 1;
2516 | /**
2517 | * Success = 2;
2518 | */
2519 | public static final int Success_VALUE = 2;
2520 | /**
2521 | * Failure = 3;
2522 | */
2523 | public static final int Failure_VALUE = 3;
2524 |
2525 |
2526 | public final int getNumber() { return value; }
2527 |
2528 | public static LoinEnum valueOf(int value) {
2529 | switch (value) {
2530 | case 1: return Request;
2531 | case 2: return Success;
2532 | case 3: return Failure;
2533 | default: return null;
2534 | }
2535 | }
2536 |
2537 | public static com.google.protobuf.Internal.EnumLiteMap
2538 | internalGetValueMap() {
2539 | return internalValueMap;
2540 | }
2541 | private static com.google.protobuf.Internal.EnumLiteMap
2542 | internalValueMap =
2543 | new com.google.protobuf.Internal.EnumLiteMap() {
2544 | public LoinEnum findValueByNumber(int number) {
2545 | return LoinEnum.valueOf(number);
2546 | }
2547 | };
2548 |
2549 | public final com.google.protobuf.Descriptors.EnumValueDescriptor
2550 | getValueDescriptor() {
2551 | return getDescriptor().getValues().get(index);
2552 | }
2553 | public final com.google.protobuf.Descriptors.EnumDescriptor
2554 | getDescriptorForType() {
2555 | return getDescriptor();
2556 | }
2557 | public static final com.google.protobuf.Descriptors.EnumDescriptor
2558 | getDescriptor() {
2559 | return com.drdg.netty.bean.InformationPacket.Login.getDescriptor().getEnumTypes().get(0);
2560 | }
2561 |
2562 | private static final LoinEnum[] VALUES = values();
2563 |
2564 | public static LoinEnum valueOf(
2565 | com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
2566 | if (desc.getType() != getDescriptor()) {
2567 | throw new java.lang.IllegalArgumentException(
2568 | "EnumValueDescriptor is not for this type.");
2569 | }
2570 | return VALUES[desc.getIndex()];
2571 | }
2572 |
2573 | private final int index;
2574 | private final int value;
2575 |
2576 | private LoinEnum(int index, int value) {
2577 | this.index = index;
2578 | this.value = value;
2579 | }
2580 |
2581 | // @@protoc_insertion_point(enum_scope:Login.LoinEnum)
2582 | }
2583 |
2584 | private int bitField0_;
2585 | // required string userName = 1;
2586 | public static final int USERNAME_FIELD_NUMBER = 1;
2587 | private java.lang.Object userName_;
2588 | /**
2589 | * required string userName = 1;
2590 | */
2591 | public boolean hasUserName() {
2592 | return ((bitField0_ & 0x00000001) == 0x00000001);
2593 | }
2594 | /**
2595 | * required string userName = 1;
2596 | */
2597 | public java.lang.String getUserName() {
2598 | java.lang.Object ref = userName_;
2599 | if (ref instanceof java.lang.String) {
2600 | return (java.lang.String) ref;
2601 | } else {
2602 | com.google.protobuf.ByteString bs =
2603 | (com.google.protobuf.ByteString) ref;
2604 | java.lang.String s = bs.toStringUtf8();
2605 | if (bs.isValidUtf8()) {
2606 | userName_ = s;
2607 | }
2608 | return s;
2609 | }
2610 | }
2611 | /**
2612 | * required string userName = 1;
2613 | */
2614 | public com.google.protobuf.ByteString
2615 | getUserNameBytes() {
2616 | java.lang.Object ref = userName_;
2617 | if (ref instanceof java.lang.String) {
2618 | com.google.protobuf.ByteString b =
2619 | com.google.protobuf.ByteString.copyFromUtf8(
2620 | (java.lang.String) ref);
2621 | userName_ = b;
2622 | return b;
2623 | } else {
2624 | return (com.google.protobuf.ByteString) ref;
2625 | }
2626 | }
2627 |
2628 | // required string userPwd = 2;
2629 | public static final int USERPWD_FIELD_NUMBER = 2;
2630 | private java.lang.Object userPwd_;
2631 | /**
2632 | * required string userPwd = 2;
2633 | */
2634 | public boolean hasUserPwd() {
2635 | return ((bitField0_ & 0x00000002) == 0x00000002);
2636 | }
2637 | /**
2638 | * required string userPwd = 2;
2639 | */
2640 | public java.lang.String getUserPwd() {
2641 | java.lang.Object ref = userPwd_;
2642 | if (ref instanceof java.lang.String) {
2643 | return (java.lang.String) ref;
2644 | } else {
2645 | com.google.protobuf.ByteString bs =
2646 | (com.google.protobuf.ByteString) ref;
2647 | java.lang.String s = bs.toStringUtf8();
2648 | if (bs.isValidUtf8()) {
2649 | userPwd_ = s;
2650 | }
2651 | return s;
2652 | }
2653 | }
2654 | /**
2655 | * required string userPwd = 2;
2656 | */
2657 | public com.google.protobuf.ByteString
2658 | getUserPwdBytes() {
2659 | java.lang.Object ref = userPwd_;
2660 | if (ref instanceof java.lang.String) {
2661 | com.google.protobuf.ByteString b =
2662 | com.google.protobuf.ByteString.copyFromUtf8(
2663 | (java.lang.String) ref);
2664 | userPwd_ = b;
2665 | return b;
2666 | } else {
2667 | return (com.google.protobuf.ByteString) ref;
2668 | }
2669 | }
2670 |
2671 | // required .Login.LoinEnum loginState = 3;
2672 | public static final int LOGINSTATE_FIELD_NUMBER = 3;
2673 | private com.drdg.netty.bean.InformationPacket.Login.LoinEnum loginState_;
2674 | /**
2675 | * required .Login.LoinEnum loginState = 3;
2676 | */
2677 | public boolean hasLoginState() {
2678 | return ((bitField0_ & 0x00000004) == 0x00000004);
2679 | }
2680 | /**
2681 | * required .Login.LoinEnum loginState = 3;
2682 | */
2683 | public com.drdg.netty.bean.InformationPacket.Login.LoinEnum getLoginState() {
2684 | return loginState_;
2685 | }
2686 |
2687 | // required string feedBackInfo = 4;
2688 | public static final int FEEDBACKINFO_FIELD_NUMBER = 4;
2689 | private java.lang.Object feedBackInfo_;
2690 | /**
2691 | * required string feedBackInfo = 4;
2692 | */
2693 | public boolean hasFeedBackInfo() {
2694 | return ((bitField0_ & 0x00000008) == 0x00000008);
2695 | }
2696 | /**
2697 | * required string feedBackInfo = 4;
2698 | */
2699 | public java.lang.String getFeedBackInfo() {
2700 | java.lang.Object ref = feedBackInfo_;
2701 | if (ref instanceof java.lang.String) {
2702 | return (java.lang.String) ref;
2703 | } else {
2704 | com.google.protobuf.ByteString bs =
2705 | (com.google.protobuf.ByteString) ref;
2706 | java.lang.String s = bs.toStringUtf8();
2707 | if (bs.isValidUtf8()) {
2708 | feedBackInfo_ = s;
2709 | }
2710 | return s;
2711 | }
2712 | }
2713 | /**
2714 | * required string feedBackInfo = 4;
2715 | */
2716 | public com.google.protobuf.ByteString
2717 | getFeedBackInfoBytes() {
2718 | java.lang.Object ref = feedBackInfo_;
2719 | if (ref instanceof java.lang.String) {
2720 | com.google.protobuf.ByteString b =
2721 | com.google.protobuf.ByteString.copyFromUtf8(
2722 | (java.lang.String) ref);
2723 | feedBackInfo_ = b;
2724 | return b;
2725 | } else {
2726 | return (com.google.protobuf.ByteString) ref;
2727 | }
2728 | }
2729 |
2730 | private void initFields() {
2731 | userName_ = "";
2732 | userPwd_ = "";
2733 | loginState_ = com.drdg.netty.bean.InformationPacket.Login.LoinEnum.Request;
2734 | feedBackInfo_ = "";
2735 | }
2736 | private byte memoizedIsInitialized = -1;
2737 | public final boolean isInitialized() {
2738 | byte isInitialized = memoizedIsInitialized;
2739 | if (isInitialized != -1) return isInitialized == 1;
2740 |
2741 | if (!hasUserName()) {
2742 | memoizedIsInitialized = 0;
2743 | return false;
2744 | }
2745 | if (!hasUserPwd()) {
2746 | memoizedIsInitialized = 0;
2747 | return false;
2748 | }
2749 | if (!hasLoginState()) {
2750 | memoizedIsInitialized = 0;
2751 | return false;
2752 | }
2753 | if (!hasFeedBackInfo()) {
2754 | memoizedIsInitialized = 0;
2755 | return false;
2756 | }
2757 | memoizedIsInitialized = 1;
2758 | return true;
2759 | }
2760 |
2761 | public void writeTo(com.google.protobuf.CodedOutputStream output)
2762 | throws java.io.IOException {
2763 | getSerializedSize();
2764 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
2765 | output.writeBytes(1, getUserNameBytes());
2766 | }
2767 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
2768 | output.writeBytes(2, getUserPwdBytes());
2769 | }
2770 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
2771 | output.writeEnum(3, loginState_.getNumber());
2772 | }
2773 | if (((bitField0_ & 0x00000008) == 0x00000008)) {
2774 | output.writeBytes(4, getFeedBackInfoBytes());
2775 | }
2776 | getUnknownFields().writeTo(output);
2777 | }
2778 |
2779 | private int memoizedSerializedSize = -1;
2780 | public int getSerializedSize() {
2781 | int size = memoizedSerializedSize;
2782 | if (size != -1) return size;
2783 |
2784 | size = 0;
2785 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
2786 | size += com.google.protobuf.CodedOutputStream
2787 | .computeBytesSize(1, getUserNameBytes());
2788 | }
2789 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
2790 | size += com.google.protobuf.CodedOutputStream
2791 | .computeBytesSize(2, getUserPwdBytes());
2792 | }
2793 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
2794 | size += com.google.protobuf.CodedOutputStream
2795 | .computeEnumSize(3, loginState_.getNumber());
2796 | }
2797 | if (((bitField0_ & 0x00000008) == 0x00000008)) {
2798 | size += com.google.protobuf.CodedOutputStream
2799 | .computeBytesSize(4, getFeedBackInfoBytes());
2800 | }
2801 | size += getUnknownFields().getSerializedSize();
2802 | memoizedSerializedSize = size;
2803 | return size;
2804 | }
2805 |
2806 | private static final long serialVersionUID = 0L;
2807 | @java.lang.Override
2808 | protected java.lang.Object writeReplace()
2809 | throws java.io.ObjectStreamException {
2810 | return super.writeReplace();
2811 | }
2812 |
2813 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(
2814 | com.google.protobuf.ByteString data)
2815 | throws com.google.protobuf.InvalidProtocolBufferException {
2816 | return PARSER.parseFrom(data);
2817 | }
2818 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(
2819 | com.google.protobuf.ByteString data,
2820 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2821 | throws com.google.protobuf.InvalidProtocolBufferException {
2822 | return PARSER.parseFrom(data, extensionRegistry);
2823 | }
2824 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(byte[] data)
2825 | throws com.google.protobuf.InvalidProtocolBufferException {
2826 | return PARSER.parseFrom(data);
2827 | }
2828 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(
2829 | byte[] data,
2830 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2831 | throws com.google.protobuf.InvalidProtocolBufferException {
2832 | return PARSER.parseFrom(data, extensionRegistry);
2833 | }
2834 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(java.io.InputStream input)
2835 | throws java.io.IOException {
2836 | return PARSER.parseFrom(input);
2837 | }
2838 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(
2839 | java.io.InputStream input,
2840 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2841 | throws java.io.IOException {
2842 | return PARSER.parseFrom(input, extensionRegistry);
2843 | }
2844 | public static com.drdg.netty.bean.InformationPacket.Login parseDelimitedFrom(java.io.InputStream input)
2845 | throws java.io.IOException {
2846 | return PARSER.parseDelimitedFrom(input);
2847 | }
2848 | public static com.drdg.netty.bean.InformationPacket.Login parseDelimitedFrom(
2849 | java.io.InputStream input,
2850 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2851 | throws java.io.IOException {
2852 | return PARSER.parseDelimitedFrom(input, extensionRegistry);
2853 | }
2854 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(
2855 | com.google.protobuf.CodedInputStream input)
2856 | throws java.io.IOException {
2857 | return PARSER.parseFrom(input);
2858 | }
2859 | public static com.drdg.netty.bean.InformationPacket.Login parseFrom(
2860 | com.google.protobuf.CodedInputStream input,
2861 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
2862 | throws java.io.IOException {
2863 | return PARSER.parseFrom(input, extensionRegistry);
2864 | }
2865 |
2866 | public static Builder newBuilder() { return Builder.create(); }
2867 | public Builder newBuilderForType() { return newBuilder(); }
2868 | public static Builder newBuilder(com.drdg.netty.bean.InformationPacket.Login prototype) {
2869 | return newBuilder().mergeFrom(prototype);
2870 | }
2871 | public Builder toBuilder() { return newBuilder(this); }
2872 |
2873 | @java.lang.Override
2874 | protected Builder newBuilderForType(
2875 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
2876 | Builder builder = new Builder(parent);
2877 | return builder;
2878 | }
2879 | /**
2880 | * Protobuf type {@code Login}
2881 | */
2882 | public static final class Builder extends
2883 | com.google.protobuf.GeneratedMessage.Builder
2884 | implements com.drdg.netty.bean.InformationPacket.LoginOrBuilder {
2885 | public static final com.google.protobuf.Descriptors.Descriptor
2886 | getDescriptor() {
2887 | return com.drdg.netty.bean.InformationPacket.internal_static_Login_descriptor;
2888 | }
2889 |
2890 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
2891 | internalGetFieldAccessorTable() {
2892 | return com.drdg.netty.bean.InformationPacket.internal_static_Login_fieldAccessorTable
2893 | .ensureFieldAccessorsInitialized(
2894 | com.drdg.netty.bean.InformationPacket.Login.class, com.drdg.netty.bean.InformationPacket.Login.Builder.class);
2895 | }
2896 |
2897 | // Construct using com.drdg.netty.bean.InformationPacket.Login.newBuilder()
2898 | private Builder() {
2899 | maybeForceBuilderInitialization();
2900 | }
2901 |
2902 | private Builder(
2903 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
2904 | super(parent);
2905 | maybeForceBuilderInitialization();
2906 | }
2907 | private void maybeForceBuilderInitialization() {
2908 | if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
2909 | }
2910 | }
2911 | private static Builder create() {
2912 | return new Builder();
2913 | }
2914 |
2915 | public Builder clear() {
2916 | super.clear();
2917 | userName_ = "";
2918 | bitField0_ = (bitField0_ & ~0x00000001);
2919 | userPwd_ = "";
2920 | bitField0_ = (bitField0_ & ~0x00000002);
2921 | loginState_ = com.drdg.netty.bean.InformationPacket.Login.LoinEnum.Request;
2922 | bitField0_ = (bitField0_ & ~0x00000004);
2923 | feedBackInfo_ = "";
2924 | bitField0_ = (bitField0_ & ~0x00000008);
2925 | return this;
2926 | }
2927 |
2928 | public Builder clone() {
2929 | return create().mergeFrom(buildPartial());
2930 | }
2931 |
2932 | public com.google.protobuf.Descriptors.Descriptor
2933 | getDescriptorForType() {
2934 | return com.drdg.netty.bean.InformationPacket.internal_static_Login_descriptor;
2935 | }
2936 |
2937 | public com.drdg.netty.bean.InformationPacket.Login getDefaultInstanceForType() {
2938 | return com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance();
2939 | }
2940 |
2941 | public com.drdg.netty.bean.InformationPacket.Login build() {
2942 | com.drdg.netty.bean.InformationPacket.Login result = buildPartial();
2943 | if (!result.isInitialized()) {
2944 | throw newUninitializedMessageException(result);
2945 | }
2946 | return result;
2947 | }
2948 |
2949 | public com.drdg.netty.bean.InformationPacket.Login buildPartial() {
2950 | com.drdg.netty.bean.InformationPacket.Login result = new com.drdg.netty.bean.InformationPacket.Login(this);
2951 | int from_bitField0_ = bitField0_;
2952 | int to_bitField0_ = 0;
2953 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
2954 | to_bitField0_ |= 0x00000001;
2955 | }
2956 | result.userName_ = userName_;
2957 | if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
2958 | to_bitField0_ |= 0x00000002;
2959 | }
2960 | result.userPwd_ = userPwd_;
2961 | if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
2962 | to_bitField0_ |= 0x00000004;
2963 | }
2964 | result.loginState_ = loginState_;
2965 | if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
2966 | to_bitField0_ |= 0x00000008;
2967 | }
2968 | result.feedBackInfo_ = feedBackInfo_;
2969 | result.bitField0_ = to_bitField0_;
2970 | onBuilt();
2971 | return result;
2972 | }
2973 |
2974 | public Builder mergeFrom(com.google.protobuf.Message other) {
2975 | if (other instanceof com.drdg.netty.bean.InformationPacket.Login) {
2976 | return mergeFrom((com.drdg.netty.bean.InformationPacket.Login)other);
2977 | } else {
2978 | super.mergeFrom(other);
2979 | return this;
2980 | }
2981 | }
2982 |
2983 | public Builder mergeFrom(com.drdg.netty.bean.InformationPacket.Login other) {
2984 | if (other == com.drdg.netty.bean.InformationPacket.Login.getDefaultInstance()) return this;
2985 | if (other.hasUserName()) {
2986 | bitField0_ |= 0x00000001;
2987 | userName_ = other.userName_;
2988 | onChanged();
2989 | }
2990 | if (other.hasUserPwd()) {
2991 | bitField0_ |= 0x00000002;
2992 | userPwd_ = other.userPwd_;
2993 | onChanged();
2994 | }
2995 | if (other.hasLoginState()) {
2996 | setLoginState(other.getLoginState());
2997 | }
2998 | if (other.hasFeedBackInfo()) {
2999 | bitField0_ |= 0x00000008;
3000 | feedBackInfo_ = other.feedBackInfo_;
3001 | onChanged();
3002 | }
3003 | this.mergeUnknownFields(other.getUnknownFields());
3004 | return this;
3005 | }
3006 |
3007 | public final boolean isInitialized() {
3008 | if (!hasUserName()) {
3009 |
3010 | return false;
3011 | }
3012 | if (!hasUserPwd()) {
3013 |
3014 | return false;
3015 | }
3016 | if (!hasLoginState()) {
3017 |
3018 | return false;
3019 | }
3020 | if (!hasFeedBackInfo()) {
3021 |
3022 | return false;
3023 | }
3024 | return true;
3025 | }
3026 |
3027 | public Builder mergeFrom(
3028 | com.google.protobuf.CodedInputStream input,
3029 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3030 | throws java.io.IOException {
3031 | com.drdg.netty.bean.InformationPacket.Login parsedMessage = null;
3032 | try {
3033 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
3034 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
3035 | parsedMessage = (com.drdg.netty.bean.InformationPacket.Login) e.getUnfinishedMessage();
3036 | throw e;
3037 | } finally {
3038 | if (parsedMessage != null) {
3039 | mergeFrom(parsedMessage);
3040 | }
3041 | }
3042 | return this;
3043 | }
3044 | private int bitField0_;
3045 |
3046 | // required string userName = 1;
3047 | private java.lang.Object userName_ = "";
3048 | /**
3049 | * required string userName = 1;
3050 | */
3051 | public boolean hasUserName() {
3052 | return ((bitField0_ & 0x00000001) == 0x00000001);
3053 | }
3054 | /**
3055 | * required string userName = 1;
3056 | */
3057 | public java.lang.String getUserName() {
3058 | java.lang.Object ref = userName_;
3059 | if (!(ref instanceof java.lang.String)) {
3060 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
3061 | .toStringUtf8();
3062 | userName_ = s;
3063 | return s;
3064 | } else {
3065 | return (java.lang.String) ref;
3066 | }
3067 | }
3068 | /**
3069 | * required string userName = 1;
3070 | */
3071 | public com.google.protobuf.ByteString
3072 | getUserNameBytes() {
3073 | java.lang.Object ref = userName_;
3074 | if (ref instanceof String) {
3075 | com.google.protobuf.ByteString b =
3076 | com.google.protobuf.ByteString.copyFromUtf8(
3077 | (java.lang.String) ref);
3078 | userName_ = b;
3079 | return b;
3080 | } else {
3081 | return (com.google.protobuf.ByteString) ref;
3082 | }
3083 | }
3084 | /**
3085 | * required string userName = 1;
3086 | */
3087 | public Builder setUserName(
3088 | java.lang.String value) {
3089 | if (value == null) {
3090 | throw new NullPointerException();
3091 | }
3092 | bitField0_ |= 0x00000001;
3093 | userName_ = value;
3094 | onChanged();
3095 | return this;
3096 | }
3097 | /**
3098 | * required string userName = 1;
3099 | */
3100 | public Builder clearUserName() {
3101 | bitField0_ = (bitField0_ & ~0x00000001);
3102 | userName_ = getDefaultInstance().getUserName();
3103 | onChanged();
3104 | return this;
3105 | }
3106 | /**
3107 | * required string userName = 1;
3108 | */
3109 | public Builder setUserNameBytes(
3110 | com.google.protobuf.ByteString value) {
3111 | if (value == null) {
3112 | throw new NullPointerException();
3113 | }
3114 | bitField0_ |= 0x00000001;
3115 | userName_ = value;
3116 | onChanged();
3117 | return this;
3118 | }
3119 |
3120 | // required string userPwd = 2;
3121 | private java.lang.Object userPwd_ = "";
3122 | /**
3123 | * required string userPwd = 2;
3124 | */
3125 | public boolean hasUserPwd() {
3126 | return ((bitField0_ & 0x00000002) == 0x00000002);
3127 | }
3128 | /**
3129 | * required string userPwd = 2;
3130 | */
3131 | public java.lang.String getUserPwd() {
3132 | java.lang.Object ref = userPwd_;
3133 | if (!(ref instanceof java.lang.String)) {
3134 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
3135 | .toStringUtf8();
3136 | userPwd_ = s;
3137 | return s;
3138 | } else {
3139 | return (java.lang.String) ref;
3140 | }
3141 | }
3142 | /**
3143 | * required string userPwd = 2;
3144 | */
3145 | public com.google.protobuf.ByteString
3146 | getUserPwdBytes() {
3147 | java.lang.Object ref = userPwd_;
3148 | if (ref instanceof String) {
3149 | com.google.protobuf.ByteString b =
3150 | com.google.protobuf.ByteString.copyFromUtf8(
3151 | (java.lang.String) ref);
3152 | userPwd_ = b;
3153 | return b;
3154 | } else {
3155 | return (com.google.protobuf.ByteString) ref;
3156 | }
3157 | }
3158 | /**
3159 | * required string userPwd = 2;
3160 | */
3161 | public Builder setUserPwd(
3162 | java.lang.String value) {
3163 | if (value == null) {
3164 | throw new NullPointerException();
3165 | }
3166 | bitField0_ |= 0x00000002;
3167 | userPwd_ = value;
3168 | onChanged();
3169 | return this;
3170 | }
3171 | /**
3172 | * required string userPwd = 2;
3173 | */
3174 | public Builder clearUserPwd() {
3175 | bitField0_ = (bitField0_ & ~0x00000002);
3176 | userPwd_ = getDefaultInstance().getUserPwd();
3177 | onChanged();
3178 | return this;
3179 | }
3180 | /**
3181 | * required string userPwd = 2;
3182 | */
3183 | public Builder setUserPwdBytes(
3184 | com.google.protobuf.ByteString value) {
3185 | if (value == null) {
3186 | throw new NullPointerException();
3187 | }
3188 | bitField0_ |= 0x00000002;
3189 | userPwd_ = value;
3190 | onChanged();
3191 | return this;
3192 | }
3193 |
3194 | // required .Login.LoinEnum loginState = 3;
3195 | private com.drdg.netty.bean.InformationPacket.Login.LoinEnum loginState_ = com.drdg.netty.bean.InformationPacket.Login.LoinEnum.Request;
3196 | /**
3197 | * required .Login.LoinEnum loginState = 3;
3198 | */
3199 | public boolean hasLoginState() {
3200 | return ((bitField0_ & 0x00000004) == 0x00000004);
3201 | }
3202 | /**
3203 | * required .Login.LoinEnum loginState = 3;
3204 | */
3205 | public com.drdg.netty.bean.InformationPacket.Login.LoinEnum getLoginState() {
3206 | return loginState_;
3207 | }
3208 | /**
3209 | * required .Login.LoinEnum loginState = 3;
3210 | */
3211 | public Builder setLoginState(com.drdg.netty.bean.InformationPacket.Login.LoinEnum value) {
3212 | if (value == null) {
3213 | throw new NullPointerException();
3214 | }
3215 | bitField0_ |= 0x00000004;
3216 | loginState_ = value;
3217 | onChanged();
3218 | return this;
3219 | }
3220 | /**
3221 | * required .Login.LoinEnum loginState = 3;
3222 | */
3223 | public Builder clearLoginState() {
3224 | bitField0_ = (bitField0_ & ~0x00000004);
3225 | loginState_ = com.drdg.netty.bean.InformationPacket.Login.LoinEnum.Request;
3226 | onChanged();
3227 | return this;
3228 | }
3229 |
3230 | // required string feedBackInfo = 4;
3231 | private java.lang.Object feedBackInfo_ = "";
3232 | /**
3233 | * required string feedBackInfo = 4;
3234 | */
3235 | public boolean hasFeedBackInfo() {
3236 | return ((bitField0_ & 0x00000008) == 0x00000008);
3237 | }
3238 | /**
3239 | * required string feedBackInfo = 4;
3240 | */
3241 | public java.lang.String getFeedBackInfo() {
3242 | java.lang.Object ref = feedBackInfo_;
3243 | if (!(ref instanceof java.lang.String)) {
3244 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
3245 | .toStringUtf8();
3246 | feedBackInfo_ = s;
3247 | return s;
3248 | } else {
3249 | return (java.lang.String) ref;
3250 | }
3251 | }
3252 | /**
3253 | * required string feedBackInfo = 4;
3254 | */
3255 | public com.google.protobuf.ByteString
3256 | getFeedBackInfoBytes() {
3257 | java.lang.Object ref = feedBackInfo_;
3258 | if (ref instanceof String) {
3259 | com.google.protobuf.ByteString b =
3260 | com.google.protobuf.ByteString.copyFromUtf8(
3261 | (java.lang.String) ref);
3262 | feedBackInfo_ = b;
3263 | return b;
3264 | } else {
3265 | return (com.google.protobuf.ByteString) ref;
3266 | }
3267 | }
3268 | /**
3269 | * required string feedBackInfo = 4;
3270 | */
3271 | public Builder setFeedBackInfo(
3272 | java.lang.String value) {
3273 | if (value == null) {
3274 | throw new NullPointerException();
3275 | }
3276 | bitField0_ |= 0x00000008;
3277 | feedBackInfo_ = value;
3278 | onChanged();
3279 | return this;
3280 | }
3281 | /**
3282 | * required string feedBackInfo = 4;
3283 | */
3284 | public Builder clearFeedBackInfo() {
3285 | bitField0_ = (bitField0_ & ~0x00000008);
3286 | feedBackInfo_ = getDefaultInstance().getFeedBackInfo();
3287 | onChanged();
3288 | return this;
3289 | }
3290 | /**
3291 | * required string feedBackInfo = 4;
3292 | */
3293 | public Builder setFeedBackInfoBytes(
3294 | com.google.protobuf.ByteString value) {
3295 | if (value == null) {
3296 | throw new NullPointerException();
3297 | }
3298 | bitField0_ |= 0x00000008;
3299 | feedBackInfo_ = value;
3300 | onChanged();
3301 | return this;
3302 | }
3303 |
3304 | // @@protoc_insertion_point(builder_scope:Login)
3305 | }
3306 |
3307 | static {
3308 | defaultInstance = new Login(true);
3309 | defaultInstance.initFields();
3310 | }
3311 |
3312 | // @@protoc_insertion_point(class_scope:Login)
3313 | }
3314 |
3315 | public interface MsgInfoOrBuilder
3316 | extends com.google.protobuf.MessageOrBuilder {
3317 |
3318 | // required string sendUser = 1;
3319 | /**
3320 | * required string sendUser = 1;
3321 | */
3322 | boolean hasSendUser();
3323 | /**
3324 | * required string sendUser = 1;
3325 | */
3326 | java.lang.String getSendUser();
3327 | /**
3328 | * required string sendUser = 1;
3329 | */
3330 | com.google.protobuf.ByteString
3331 | getSendUserBytes();
3332 |
3333 | // required string sendToUser = 2;
3334 | /**
3335 | * required string sendToUser = 2;
3336 | */
3337 | boolean hasSendToUser();
3338 | /**
3339 | * required string sendToUser = 2;
3340 | */
3341 | java.lang.String getSendToUser();
3342 | /**
3343 | * required string sendToUser = 2;
3344 | */
3345 | com.google.protobuf.ByteString
3346 | getSendToUserBytes();
3347 |
3348 | // required string sendInfo = 3;
3349 | /**
3350 | * required string sendInfo = 3;
3351 | */
3352 | boolean hasSendInfo();
3353 | /**
3354 | * required string sendInfo = 3;
3355 | */
3356 | java.lang.String getSendInfo();
3357 | /**
3358 | * required string sendInfo = 3;
3359 | */
3360 | com.google.protobuf.ByteString
3361 | getSendInfoBytes();
3362 | }
3363 | /**
3364 | * Protobuf type {@code MsgInfo}
3365 | */
3366 | public static final class MsgInfo extends
3367 | com.google.protobuf.GeneratedMessage
3368 | implements MsgInfoOrBuilder {
3369 | // Use MsgInfo.newBuilder() to construct.
3370 | private MsgInfo(com.google.protobuf.GeneratedMessage.Builder> builder) {
3371 | super(builder);
3372 | this.unknownFields = builder.getUnknownFields();
3373 | }
3374 | private MsgInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
3375 |
3376 | private static final MsgInfo defaultInstance;
3377 | public static MsgInfo getDefaultInstance() {
3378 | return defaultInstance;
3379 | }
3380 |
3381 | public MsgInfo getDefaultInstanceForType() {
3382 | return defaultInstance;
3383 | }
3384 |
3385 | private final com.google.protobuf.UnknownFieldSet unknownFields;
3386 | @java.lang.Override
3387 | public final com.google.protobuf.UnknownFieldSet
3388 | getUnknownFields() {
3389 | return this.unknownFields;
3390 | }
3391 | private MsgInfo(
3392 | com.google.protobuf.CodedInputStream input,
3393 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3394 | throws com.google.protobuf.InvalidProtocolBufferException {
3395 | initFields();
3396 | int mutable_bitField0_ = 0;
3397 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
3398 | com.google.protobuf.UnknownFieldSet.newBuilder();
3399 | try {
3400 | boolean done = false;
3401 | while (!done) {
3402 | int tag = input.readTag();
3403 | switch (tag) {
3404 | case 0:
3405 | done = true;
3406 | break;
3407 | default: {
3408 | if (!parseUnknownField(input, unknownFields,
3409 | extensionRegistry, tag)) {
3410 | done = true;
3411 | }
3412 | break;
3413 | }
3414 | case 10: {
3415 | bitField0_ |= 0x00000001;
3416 | sendUser_ = input.readBytes();
3417 | break;
3418 | }
3419 | case 18: {
3420 | bitField0_ |= 0x00000002;
3421 | sendToUser_ = input.readBytes();
3422 | break;
3423 | }
3424 | case 26: {
3425 | bitField0_ |= 0x00000004;
3426 | sendInfo_ = input.readBytes();
3427 | break;
3428 | }
3429 | }
3430 | }
3431 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
3432 | throw e.setUnfinishedMessage(this);
3433 | } catch (java.io.IOException e) {
3434 | throw new com.google.protobuf.InvalidProtocolBufferException(
3435 | e.getMessage()).setUnfinishedMessage(this);
3436 | } finally {
3437 | this.unknownFields = unknownFields.build();
3438 | makeExtensionsImmutable();
3439 | }
3440 | }
3441 | public static final com.google.protobuf.Descriptors.Descriptor
3442 | getDescriptor() {
3443 | return com.drdg.netty.bean.InformationPacket.internal_static_MsgInfo_descriptor;
3444 | }
3445 |
3446 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
3447 | internalGetFieldAccessorTable() {
3448 | return com.drdg.netty.bean.InformationPacket.internal_static_MsgInfo_fieldAccessorTable
3449 | .ensureFieldAccessorsInitialized(
3450 | com.drdg.netty.bean.InformationPacket.MsgInfo.class, com.drdg.netty.bean.InformationPacket.MsgInfo.Builder.class);
3451 | }
3452 |
3453 | public static com.google.protobuf.Parser PARSER =
3454 | new com.google.protobuf.AbstractParser() {
3455 | public MsgInfo parsePartialFrom(
3456 | com.google.protobuf.CodedInputStream input,
3457 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3458 | throws com.google.protobuf.InvalidProtocolBufferException {
3459 | return new MsgInfo(input, extensionRegistry);
3460 | }
3461 | };
3462 |
3463 | @java.lang.Override
3464 | public com.google.protobuf.Parser getParserForType() {
3465 | return PARSER;
3466 | }
3467 |
3468 | private int bitField0_;
3469 | // required string sendUser = 1;
3470 | public static final int SENDUSER_FIELD_NUMBER = 1;
3471 | private java.lang.Object sendUser_;
3472 | /**
3473 | * required string sendUser = 1;
3474 | */
3475 | public boolean hasSendUser() {
3476 | return ((bitField0_ & 0x00000001) == 0x00000001);
3477 | }
3478 | /**
3479 | * required string sendUser = 1;
3480 | */
3481 | public java.lang.String getSendUser() {
3482 | java.lang.Object ref = sendUser_;
3483 | if (ref instanceof java.lang.String) {
3484 | return (java.lang.String) ref;
3485 | } else {
3486 | com.google.protobuf.ByteString bs =
3487 | (com.google.protobuf.ByteString) ref;
3488 | java.lang.String s = bs.toStringUtf8();
3489 | if (bs.isValidUtf8()) {
3490 | sendUser_ = s;
3491 | }
3492 | return s;
3493 | }
3494 | }
3495 | /**
3496 | * required string sendUser = 1;
3497 | */
3498 | public com.google.protobuf.ByteString
3499 | getSendUserBytes() {
3500 | java.lang.Object ref = sendUser_;
3501 | if (ref instanceof java.lang.String) {
3502 | com.google.protobuf.ByteString b =
3503 | com.google.protobuf.ByteString.copyFromUtf8(
3504 | (java.lang.String) ref);
3505 | sendUser_ = b;
3506 | return b;
3507 | } else {
3508 | return (com.google.protobuf.ByteString) ref;
3509 | }
3510 | }
3511 |
3512 | // required string sendToUser = 2;
3513 | public static final int SENDTOUSER_FIELD_NUMBER = 2;
3514 | private java.lang.Object sendToUser_;
3515 | /**
3516 | * required string sendToUser = 2;
3517 | */
3518 | public boolean hasSendToUser() {
3519 | return ((bitField0_ & 0x00000002) == 0x00000002);
3520 | }
3521 | /**
3522 | * required string sendToUser = 2;
3523 | */
3524 | public java.lang.String getSendToUser() {
3525 | java.lang.Object ref = sendToUser_;
3526 | if (ref instanceof java.lang.String) {
3527 | return (java.lang.String) ref;
3528 | } else {
3529 | com.google.protobuf.ByteString bs =
3530 | (com.google.protobuf.ByteString) ref;
3531 | java.lang.String s = bs.toStringUtf8();
3532 | if (bs.isValidUtf8()) {
3533 | sendToUser_ = s;
3534 | }
3535 | return s;
3536 | }
3537 | }
3538 | /**
3539 | * required string sendToUser = 2;
3540 | */
3541 | public com.google.protobuf.ByteString
3542 | getSendToUserBytes() {
3543 | java.lang.Object ref = sendToUser_;
3544 | if (ref instanceof java.lang.String) {
3545 | com.google.protobuf.ByteString b =
3546 | com.google.protobuf.ByteString.copyFromUtf8(
3547 | (java.lang.String) ref);
3548 | sendToUser_ = b;
3549 | return b;
3550 | } else {
3551 | return (com.google.protobuf.ByteString) ref;
3552 | }
3553 | }
3554 |
3555 | // required string sendInfo = 3;
3556 | public static final int SENDINFO_FIELD_NUMBER = 3;
3557 | private java.lang.Object sendInfo_;
3558 | /**
3559 | * required string sendInfo = 3;
3560 | */
3561 | public boolean hasSendInfo() {
3562 | return ((bitField0_ & 0x00000004) == 0x00000004);
3563 | }
3564 | /**
3565 | * required string sendInfo = 3;
3566 | */
3567 | public java.lang.String getSendInfo() {
3568 | java.lang.Object ref = sendInfo_;
3569 | if (ref instanceof java.lang.String) {
3570 | return (java.lang.String) ref;
3571 | } else {
3572 | com.google.protobuf.ByteString bs =
3573 | (com.google.protobuf.ByteString) ref;
3574 | java.lang.String s = bs.toStringUtf8();
3575 | if (bs.isValidUtf8()) {
3576 | sendInfo_ = s;
3577 | }
3578 | return s;
3579 | }
3580 | }
3581 | /**
3582 | * required string sendInfo = 3;
3583 | */
3584 | public com.google.protobuf.ByteString
3585 | getSendInfoBytes() {
3586 | java.lang.Object ref = sendInfo_;
3587 | if (ref instanceof java.lang.String) {
3588 | com.google.protobuf.ByteString b =
3589 | com.google.protobuf.ByteString.copyFromUtf8(
3590 | (java.lang.String) ref);
3591 | sendInfo_ = b;
3592 | return b;
3593 | } else {
3594 | return (com.google.protobuf.ByteString) ref;
3595 | }
3596 | }
3597 |
3598 | private void initFields() {
3599 | sendUser_ = "";
3600 | sendToUser_ = "";
3601 | sendInfo_ = "";
3602 | }
3603 | private byte memoizedIsInitialized = -1;
3604 | public final boolean isInitialized() {
3605 | byte isInitialized = memoizedIsInitialized;
3606 | if (isInitialized != -1) return isInitialized == 1;
3607 |
3608 | if (!hasSendUser()) {
3609 | memoizedIsInitialized = 0;
3610 | return false;
3611 | }
3612 | if (!hasSendToUser()) {
3613 | memoizedIsInitialized = 0;
3614 | return false;
3615 | }
3616 | if (!hasSendInfo()) {
3617 | memoizedIsInitialized = 0;
3618 | return false;
3619 | }
3620 | memoizedIsInitialized = 1;
3621 | return true;
3622 | }
3623 |
3624 | public void writeTo(com.google.protobuf.CodedOutputStream output)
3625 | throws java.io.IOException {
3626 | getSerializedSize();
3627 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
3628 | output.writeBytes(1, getSendUserBytes());
3629 | }
3630 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
3631 | output.writeBytes(2, getSendToUserBytes());
3632 | }
3633 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
3634 | output.writeBytes(3, getSendInfoBytes());
3635 | }
3636 | getUnknownFields().writeTo(output);
3637 | }
3638 |
3639 | private int memoizedSerializedSize = -1;
3640 | public int getSerializedSize() {
3641 | int size = memoizedSerializedSize;
3642 | if (size != -1) return size;
3643 |
3644 | size = 0;
3645 | if (((bitField0_ & 0x00000001) == 0x00000001)) {
3646 | size += com.google.protobuf.CodedOutputStream
3647 | .computeBytesSize(1, getSendUserBytes());
3648 | }
3649 | if (((bitField0_ & 0x00000002) == 0x00000002)) {
3650 | size += com.google.protobuf.CodedOutputStream
3651 | .computeBytesSize(2, getSendToUserBytes());
3652 | }
3653 | if (((bitField0_ & 0x00000004) == 0x00000004)) {
3654 | size += com.google.protobuf.CodedOutputStream
3655 | .computeBytesSize(3, getSendInfoBytes());
3656 | }
3657 | size += getUnknownFields().getSerializedSize();
3658 | memoizedSerializedSize = size;
3659 | return size;
3660 | }
3661 |
3662 | private static final long serialVersionUID = 0L;
3663 | @java.lang.Override
3664 | protected java.lang.Object writeReplace()
3665 | throws java.io.ObjectStreamException {
3666 | return super.writeReplace();
3667 | }
3668 |
3669 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(
3670 | com.google.protobuf.ByteString data)
3671 | throws com.google.protobuf.InvalidProtocolBufferException {
3672 | return PARSER.parseFrom(data);
3673 | }
3674 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(
3675 | com.google.protobuf.ByteString data,
3676 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3677 | throws com.google.protobuf.InvalidProtocolBufferException {
3678 | return PARSER.parseFrom(data, extensionRegistry);
3679 | }
3680 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(byte[] data)
3681 | throws com.google.protobuf.InvalidProtocolBufferException {
3682 | return PARSER.parseFrom(data);
3683 | }
3684 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(
3685 | byte[] data,
3686 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3687 | throws com.google.protobuf.InvalidProtocolBufferException {
3688 | return PARSER.parseFrom(data, extensionRegistry);
3689 | }
3690 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(java.io.InputStream input)
3691 | throws java.io.IOException {
3692 | return PARSER.parseFrom(input);
3693 | }
3694 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(
3695 | java.io.InputStream input,
3696 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3697 | throws java.io.IOException {
3698 | return PARSER.parseFrom(input, extensionRegistry);
3699 | }
3700 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseDelimitedFrom(java.io.InputStream input)
3701 | throws java.io.IOException {
3702 | return PARSER.parseDelimitedFrom(input);
3703 | }
3704 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseDelimitedFrom(
3705 | java.io.InputStream input,
3706 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3707 | throws java.io.IOException {
3708 | return PARSER.parseDelimitedFrom(input, extensionRegistry);
3709 | }
3710 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(
3711 | com.google.protobuf.CodedInputStream input)
3712 | throws java.io.IOException {
3713 | return PARSER.parseFrom(input);
3714 | }
3715 | public static com.drdg.netty.bean.InformationPacket.MsgInfo parseFrom(
3716 | com.google.protobuf.CodedInputStream input,
3717 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3718 | throws java.io.IOException {
3719 | return PARSER.parseFrom(input, extensionRegistry);
3720 | }
3721 |
3722 | public static Builder newBuilder() { return Builder.create(); }
3723 | public Builder newBuilderForType() { return newBuilder(); }
3724 | public static Builder newBuilder(com.drdg.netty.bean.InformationPacket.MsgInfo prototype) {
3725 | return newBuilder().mergeFrom(prototype);
3726 | }
3727 | public Builder toBuilder() { return newBuilder(this); }
3728 |
3729 | @java.lang.Override
3730 | protected Builder newBuilderForType(
3731 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
3732 | Builder builder = new Builder(parent);
3733 | return builder;
3734 | }
3735 | /**
3736 | * Protobuf type {@code MsgInfo}
3737 | */
3738 | public static final class Builder extends
3739 | com.google.protobuf.GeneratedMessage.Builder
3740 | implements com.drdg.netty.bean.InformationPacket.MsgInfoOrBuilder {
3741 | public static final com.google.protobuf.Descriptors.Descriptor
3742 | getDescriptor() {
3743 | return com.drdg.netty.bean.InformationPacket.internal_static_MsgInfo_descriptor;
3744 | }
3745 |
3746 | protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
3747 | internalGetFieldAccessorTable() {
3748 | return com.drdg.netty.bean.InformationPacket.internal_static_MsgInfo_fieldAccessorTable
3749 | .ensureFieldAccessorsInitialized(
3750 | com.drdg.netty.bean.InformationPacket.MsgInfo.class, com.drdg.netty.bean.InformationPacket.MsgInfo.Builder.class);
3751 | }
3752 |
3753 | // Construct using com.drdg.netty.bean.InformationPacket.MsgInfo.newBuilder()
3754 | private Builder() {
3755 | maybeForceBuilderInitialization();
3756 | }
3757 |
3758 | private Builder(
3759 | com.google.protobuf.GeneratedMessage.BuilderParent parent) {
3760 | super(parent);
3761 | maybeForceBuilderInitialization();
3762 | }
3763 | private void maybeForceBuilderInitialization() {
3764 | if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
3765 | }
3766 | }
3767 | private static Builder create() {
3768 | return new Builder();
3769 | }
3770 |
3771 | public Builder clear() {
3772 | super.clear();
3773 | sendUser_ = "";
3774 | bitField0_ = (bitField0_ & ~0x00000001);
3775 | sendToUser_ = "";
3776 | bitField0_ = (bitField0_ & ~0x00000002);
3777 | sendInfo_ = "";
3778 | bitField0_ = (bitField0_ & ~0x00000004);
3779 | return this;
3780 | }
3781 |
3782 | public Builder clone() {
3783 | return create().mergeFrom(buildPartial());
3784 | }
3785 |
3786 | public com.google.protobuf.Descriptors.Descriptor
3787 | getDescriptorForType() {
3788 | return com.drdg.netty.bean.InformationPacket.internal_static_MsgInfo_descriptor;
3789 | }
3790 |
3791 | public com.drdg.netty.bean.InformationPacket.MsgInfo getDefaultInstanceForType() {
3792 | return com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance();
3793 | }
3794 |
3795 | public com.drdg.netty.bean.InformationPacket.MsgInfo build() {
3796 | com.drdg.netty.bean.InformationPacket.MsgInfo result = buildPartial();
3797 | if (!result.isInitialized()) {
3798 | throw newUninitializedMessageException(result);
3799 | }
3800 | return result;
3801 | }
3802 |
3803 | public com.drdg.netty.bean.InformationPacket.MsgInfo buildPartial() {
3804 | com.drdg.netty.bean.InformationPacket.MsgInfo result = new com.drdg.netty.bean.InformationPacket.MsgInfo(this);
3805 | int from_bitField0_ = bitField0_;
3806 | int to_bitField0_ = 0;
3807 | if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
3808 | to_bitField0_ |= 0x00000001;
3809 | }
3810 | result.sendUser_ = sendUser_;
3811 | if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
3812 | to_bitField0_ |= 0x00000002;
3813 | }
3814 | result.sendToUser_ = sendToUser_;
3815 | if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
3816 | to_bitField0_ |= 0x00000004;
3817 | }
3818 | result.sendInfo_ = sendInfo_;
3819 | result.bitField0_ = to_bitField0_;
3820 | onBuilt();
3821 | return result;
3822 | }
3823 |
3824 | public Builder mergeFrom(com.google.protobuf.Message other) {
3825 | if (other instanceof com.drdg.netty.bean.InformationPacket.MsgInfo) {
3826 | return mergeFrom((com.drdg.netty.bean.InformationPacket.MsgInfo)other);
3827 | } else {
3828 | super.mergeFrom(other);
3829 | return this;
3830 | }
3831 | }
3832 |
3833 | public Builder mergeFrom(com.drdg.netty.bean.InformationPacket.MsgInfo other) {
3834 | if (other == com.drdg.netty.bean.InformationPacket.MsgInfo.getDefaultInstance()) return this;
3835 | if (other.hasSendUser()) {
3836 | bitField0_ |= 0x00000001;
3837 | sendUser_ = other.sendUser_;
3838 | onChanged();
3839 | }
3840 | if (other.hasSendToUser()) {
3841 | bitField0_ |= 0x00000002;
3842 | sendToUser_ = other.sendToUser_;
3843 | onChanged();
3844 | }
3845 | if (other.hasSendInfo()) {
3846 | bitField0_ |= 0x00000004;
3847 | sendInfo_ = other.sendInfo_;
3848 | onChanged();
3849 | }
3850 | this.mergeUnknownFields(other.getUnknownFields());
3851 | return this;
3852 | }
3853 |
3854 | public final boolean isInitialized() {
3855 | if (!hasSendUser()) {
3856 |
3857 | return false;
3858 | }
3859 | if (!hasSendToUser()) {
3860 |
3861 | return false;
3862 | }
3863 | if (!hasSendInfo()) {
3864 |
3865 | return false;
3866 | }
3867 | return true;
3868 | }
3869 |
3870 | public Builder mergeFrom(
3871 | com.google.protobuf.CodedInputStream input,
3872 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
3873 | throws java.io.IOException {
3874 | com.drdg.netty.bean.InformationPacket.MsgInfo parsedMessage = null;
3875 | try {
3876 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
3877 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
3878 | parsedMessage = (com.drdg.netty.bean.InformationPacket.MsgInfo) e.getUnfinishedMessage();
3879 | throw e;
3880 | } finally {
3881 | if (parsedMessage != null) {
3882 | mergeFrom(parsedMessage);
3883 | }
3884 | }
3885 | return this;
3886 | }
3887 | private int bitField0_;
3888 |
3889 | // required string sendUser = 1;
3890 | private java.lang.Object sendUser_ = "";
3891 | /**
3892 | * required string sendUser = 1;
3893 | */
3894 | public boolean hasSendUser() {
3895 | return ((bitField0_ & 0x00000001) == 0x00000001);
3896 | }
3897 | /**
3898 | * required string sendUser = 1;
3899 | */
3900 | public java.lang.String getSendUser() {
3901 | java.lang.Object ref = sendUser_;
3902 | if (!(ref instanceof java.lang.String)) {
3903 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
3904 | .toStringUtf8();
3905 | sendUser_ = s;
3906 | return s;
3907 | } else {
3908 | return (java.lang.String) ref;
3909 | }
3910 | }
3911 | /**
3912 | * required string sendUser = 1;
3913 | */
3914 | public com.google.protobuf.ByteString
3915 | getSendUserBytes() {
3916 | java.lang.Object ref = sendUser_;
3917 | if (ref instanceof String) {
3918 | com.google.protobuf.ByteString b =
3919 | com.google.protobuf.ByteString.copyFromUtf8(
3920 | (java.lang.String) ref);
3921 | sendUser_ = b;
3922 | return b;
3923 | } else {
3924 | return (com.google.protobuf.ByteString) ref;
3925 | }
3926 | }
3927 | /**
3928 | * required string sendUser = 1;
3929 | */
3930 | public Builder setSendUser(
3931 | java.lang.String value) {
3932 | if (value == null) {
3933 | throw new NullPointerException();
3934 | }
3935 | bitField0_ |= 0x00000001;
3936 | sendUser_ = value;
3937 | onChanged();
3938 | return this;
3939 | }
3940 | /**
3941 | * required string sendUser = 1;
3942 | */
3943 | public Builder clearSendUser() {
3944 | bitField0_ = (bitField0_ & ~0x00000001);
3945 | sendUser_ = getDefaultInstance().getSendUser();
3946 | onChanged();
3947 | return this;
3948 | }
3949 | /**
3950 | * required string sendUser = 1;
3951 | */
3952 | public Builder setSendUserBytes(
3953 | com.google.protobuf.ByteString value) {
3954 | if (value == null) {
3955 | throw new NullPointerException();
3956 | }
3957 | bitField0_ |= 0x00000001;
3958 | sendUser_ = value;
3959 | onChanged();
3960 | return this;
3961 | }
3962 |
3963 | // required string sendToUser = 2;
3964 | private java.lang.Object sendToUser_ = "";
3965 | /**
3966 | * required string sendToUser = 2;
3967 | */
3968 | public boolean hasSendToUser() {
3969 | return ((bitField0_ & 0x00000002) == 0x00000002);
3970 | }
3971 | /**
3972 | * required string sendToUser = 2;
3973 | */
3974 | public java.lang.String getSendToUser() {
3975 | java.lang.Object ref = sendToUser_;
3976 | if (!(ref instanceof java.lang.String)) {
3977 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
3978 | .toStringUtf8();
3979 | sendToUser_ = s;
3980 | return s;
3981 | } else {
3982 | return (java.lang.String) ref;
3983 | }
3984 | }
3985 | /**
3986 | * required string sendToUser = 2;
3987 | */
3988 | public com.google.protobuf.ByteString
3989 | getSendToUserBytes() {
3990 | java.lang.Object ref = sendToUser_;
3991 | if (ref instanceof String) {
3992 | com.google.protobuf.ByteString b =
3993 | com.google.protobuf.ByteString.copyFromUtf8(
3994 | (java.lang.String) ref);
3995 | sendToUser_ = b;
3996 | return b;
3997 | } else {
3998 | return (com.google.protobuf.ByteString) ref;
3999 | }
4000 | }
4001 | /**
4002 | * required string sendToUser = 2;
4003 | */
4004 | public Builder setSendToUser(
4005 | java.lang.String value) {
4006 | if (value == null) {
4007 | throw new NullPointerException();
4008 | }
4009 | bitField0_ |= 0x00000002;
4010 | sendToUser_ = value;
4011 | onChanged();
4012 | return this;
4013 | }
4014 | /**
4015 | * required string sendToUser = 2;
4016 | */
4017 | public Builder clearSendToUser() {
4018 | bitField0_ = (bitField0_ & ~0x00000002);
4019 | sendToUser_ = getDefaultInstance().getSendToUser();
4020 | onChanged();
4021 | return this;
4022 | }
4023 | /**
4024 | * required string sendToUser = 2;
4025 | */
4026 | public Builder setSendToUserBytes(
4027 | com.google.protobuf.ByteString value) {
4028 | if (value == null) {
4029 | throw new NullPointerException();
4030 | }
4031 | bitField0_ |= 0x00000002;
4032 | sendToUser_ = value;
4033 | onChanged();
4034 | return this;
4035 | }
4036 |
4037 | // required string sendInfo = 3;
4038 | private java.lang.Object sendInfo_ = "";
4039 | /**
4040 | * required string sendInfo = 3;
4041 | */
4042 | public boolean hasSendInfo() {
4043 | return ((bitField0_ & 0x00000004) == 0x00000004);
4044 | }
4045 | /**
4046 | * required string sendInfo = 3;
4047 | */
4048 | public java.lang.String getSendInfo() {
4049 | java.lang.Object ref = sendInfo_;
4050 | if (!(ref instanceof java.lang.String)) {
4051 | java.lang.String s = ((com.google.protobuf.ByteString) ref)
4052 | .toStringUtf8();
4053 | sendInfo_ = s;
4054 | return s;
4055 | } else {
4056 | return (java.lang.String) ref;
4057 | }
4058 | }
4059 | /**
4060 | * required string sendInfo = 3;
4061 | */
4062 | public com.google.protobuf.ByteString
4063 | getSendInfoBytes() {
4064 | java.lang.Object ref = sendInfo_;
4065 | if (ref instanceof String) {
4066 | com.google.protobuf.ByteString b =
4067 | com.google.protobuf.ByteString.copyFromUtf8(
4068 | (java.lang.String) ref);
4069 | sendInfo_ = b;
4070 | return b;
4071 | } else {
4072 | return (com.google.protobuf.ByteString) ref;
4073 | }
4074 | }
4075 | /**
4076 | * required string sendInfo = 3;
4077 | */
4078 | public Builder setSendInfo(
4079 | java.lang.String value) {
4080 | if (value == null) {
4081 | throw new NullPointerException();
4082 | }
4083 | bitField0_ |= 0x00000004;
4084 | sendInfo_ = value;
4085 | onChanged();
4086 | return this;
4087 | }
4088 | /**
4089 | * required string sendInfo = 3;
4090 | */
4091 | public Builder clearSendInfo() {
4092 | bitField0_ = (bitField0_ & ~0x00000004);
4093 | sendInfo_ = getDefaultInstance().getSendInfo();
4094 | onChanged();
4095 | return this;
4096 | }
4097 | /**
4098 | * required string sendInfo = 3;
4099 | */
4100 | public Builder setSendInfoBytes(
4101 | com.google.protobuf.ByteString value) {
4102 | if (value == null) {
4103 | throw new NullPointerException();
4104 | }
4105 | bitField0_ |= 0x00000004;
4106 | sendInfo_ = value;
4107 | onChanged();
4108 | return this;
4109 | }
4110 |
4111 | // @@protoc_insertion_point(builder_scope:MsgInfo)
4112 | }
4113 |
4114 | static {
4115 | defaultInstance = new MsgInfo(true);
4116 | defaultInstance.initFields();
4117 | }
4118 |
4119 | // @@protoc_insertion_point(class_scope:MsgInfo)
4120 | }
4121 |
4122 | private static com.google.protobuf.Descriptors.Descriptor
4123 | internal_static_Group_descriptor;
4124 | private static
4125 | com.google.protobuf.GeneratedMessage.FieldAccessorTable
4126 | internal_static_Group_fieldAccessorTable;
4127 | private static com.google.protobuf.Descriptors.Descriptor
4128 | internal_static_Group_User_descriptor;
4129 | private static
4130 | com.google.protobuf.GeneratedMessage.FieldAccessorTable
4131 | internal_static_Group_User_fieldAccessorTable;
4132 | private static com.google.protobuf.Descriptors.Descriptor
4133 | internal_static_Login_descriptor;
4134 | private static
4135 | com.google.protobuf.GeneratedMessage.FieldAccessorTable
4136 | internal_static_Login_fieldAccessorTable;
4137 | private static com.google.protobuf.Descriptors.Descriptor
4138 | internal_static_MsgInfo_descriptor;
4139 | private static
4140 | com.google.protobuf.GeneratedMessage.FieldAccessorTable
4141 | internal_static_MsgInfo_fieldAccessorTable;
4142 |
4143 | public static com.google.protobuf.Descriptors.FileDescriptor
4144 | getDescriptor() {
4145 | return descriptor;
4146 | }
4147 | private static com.google.protobuf.Descriptors.FileDescriptor
4148 | descriptor;
4149 | static {
4150 | java.lang.String[] descriptorData = {
4151 | "\n\ninfo.proto\"\233\002\n\005Group\022\031\n\007msgEnum\030\001 \002(\0162" +
4152 | "\010.MsgEnum\022\025\n\005login\030\002 \002(\0132\006.Login\022\031\n\007msgI" +
4153 | "nfo\030\003 \002(\0132\010.MsgInfo\0223\n\021serverConnectEnum" +
4154 | "\030\004 \002(\0162\030.Group.ServerConnectEnum\022\035\n\010user" +
4155 | "List\030\005 \003(\0132\013.Group.User\0325\n\004User\022\n\n\002id\030\001 " +
4156 | "\002(\t\022\020\n\010userName\030\002 \002(\t\022\017\n\007userPwd\030\003 \002(\t\":" +
4157 | "\n\021ServerConnectEnum\022\013\n\007Request\020\001\022\013\n\007Succ" +
4158 | "ess\020\002\022\013\n\007Failure\020\003\"\230\001\n\005Login\022\020\n\010userName" +
4159 | "\030\001 \002(\t\022\017\n\007userPwd\030\002 \002(\t\022#\n\nloginState\030\003 " +
4160 | "\002(\0162\017.Login.LoinEnum\022\024\n\014feedBackInfo\030\004 \002",
4161 | "(\t\"1\n\010LoinEnum\022\013\n\007Request\020\001\022\013\n\007Success\020\002" +
4162 | "\022\013\n\007Failure\020\003\"A\n\007MsgInfo\022\020\n\010sendUser\030\001 \002" +
4163 | "(\t\022\022\n\nsendToUser\030\002 \002(\t\022\020\n\010sendInfo\030\003 \002(\t" +
4164 | "*g\n\007MsgEnum\022\024\n\020ReuqestToConnect\020\001\022\020\n\014Che" +
4165 | "ckToLogin\020\002\022\020\n\014ChatOneToOne\020\003\022\020\n\014ChatOne" +
4166 | "ToAll\020\004\022\020\n\014ChatToFriend\020\005B(\n\023com.drdg.ne" +
4167 | "tty.beanB\021InformationPacket"
4168 | };
4169 | com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
4170 | new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
4171 | public com.google.protobuf.ExtensionRegistry assignDescriptors(
4172 | com.google.protobuf.Descriptors.FileDescriptor root) {
4173 | descriptor = root;
4174 | internal_static_Group_descriptor =
4175 | getDescriptor().getMessageTypes().get(0);
4176 | internal_static_Group_fieldAccessorTable = new
4177 | com.google.protobuf.GeneratedMessage.FieldAccessorTable(
4178 | internal_static_Group_descriptor,
4179 | new java.lang.String[] { "MsgEnum", "Login", "MsgInfo", "ServerConnectEnum", "UserList", });
4180 | internal_static_Group_User_descriptor =
4181 | internal_static_Group_descriptor.getNestedTypes().get(0);
4182 | internal_static_Group_User_fieldAccessorTable = new
4183 | com.google.protobuf.GeneratedMessage.FieldAccessorTable(
4184 | internal_static_Group_User_descriptor,
4185 | new java.lang.String[] { "Id", "UserName", "UserPwd", });
4186 | internal_static_Login_descriptor =
4187 | getDescriptor().getMessageTypes().get(1);
4188 | internal_static_Login_fieldAccessorTable = new
4189 | com.google.protobuf.GeneratedMessage.FieldAccessorTable(
4190 | internal_static_Login_descriptor,
4191 | new java.lang.String[] { "UserName", "UserPwd", "LoginState", "FeedBackInfo", });
4192 | internal_static_MsgInfo_descriptor =
4193 | getDescriptor().getMessageTypes().get(2);
4194 | internal_static_MsgInfo_fieldAccessorTable = new
4195 | com.google.protobuf.GeneratedMessage.FieldAccessorTable(
4196 | internal_static_MsgInfo_descriptor,
4197 | new java.lang.String[] { "SendUser", "SendToUser", "SendInfo", });
4198 | return null;
4199 | }
4200 | };
4201 | com.google.protobuf.Descriptors.FileDescriptor
4202 | .internalBuildGeneratedFileFrom(descriptorData,
4203 | new com.google.protobuf.Descriptors.FileDescriptor[] {
4204 | }, assigner);
4205 | }
4206 |
4207 | // @@protoc_insertion_point(outer_class_scope)
4208 | }
4209 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/bean/UserBean.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.bean;
2 |
3 | public class UserBean {
4 |
5 | private String userName = "";
6 | private String userPwd = "";
7 |
8 | public String getUserName() {
9 | return userName;
10 | }
11 | public void setUserName(String userName) {
12 | this.userName = userName;
13 | }
14 | public String getUserPwd() {
15 | return userPwd;
16 | }
17 | public void setUserPwd(String userPwd) {
18 | this.userPwd = userPwd;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/client/ChildChannelHandler.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.client;
2 |
3 | import com.drdg.netty.bean.InformationPacket;
4 | import com.drdg.netty.control.CoreBusinessControl;
5 |
6 | import io.netty.channel.ChannelInitializer;
7 | import io.netty.channel.socket.SocketChannel;
8 | import io.netty.handler.codec.protobuf.ProtobufDecoder;
9 | import io.netty.handler.codec.protobuf.ProtobufEncoder;
10 | import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
11 | import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
12 |
13 | public class ChildChannelHandler extends ChannelInitializer{
14 |
15 | @Override
16 | protected void initChannel(SocketChannel sc) throws Exception {
17 |
18 | sc.pipeline().addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
19 | sc.pipeline().addLast("protobufDecoder", new ProtobufDecoder(InformationPacket.Group.getDefaultInstance()));
20 | sc.pipeline().addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
21 | sc.pipeline().addLast("protobufEncoder", new ProtobufEncoder());
22 | sc.pipeline().addLast("handler", new TimeClientHandler());
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/client/NettyClient.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.client;
2 |
3 | import io.netty.bootstrap.Bootstrap;
4 | import io.netty.channel.ChannelFuture;
5 | import io.netty.channel.ChannelOption;
6 | import io.netty.channel.EventLoopGroup;
7 | import io.netty.channel.nio.NioEventLoopGroup;
8 | import io.netty.channel.socket.nio.NioSocketChannel;
9 |
10 | public class NettyClient {
11 |
12 | public void connect(int inetPort,String inetHost) throws Exception{
13 |
14 | EventLoopGroup group = new NioEventLoopGroup();
15 |
16 | try {
17 |
18 | Bootstrap b = new Bootstrap();
19 |
20 | b.group(group).channel(NioSocketChannel.class);
21 | b.option(ChannelOption.TCP_NODELAY, true);
22 | b.handler(new ChildChannelHandler());
23 |
24 | //发起异步连接操作
25 | ChannelFuture f = b.connect(inetHost, inetPort);
26 |
27 | //等待客户端链路关闭
28 | f.channel().closeFuture().sync();
29 |
30 | }finally{
31 | group.shutdownGracefully();
32 | }
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/client/TimeClientHandler.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.client;
2 |
3 | import java.util.logging.Logger;
4 |
5 | import com.drdg.netty.agreement.MsgAgreement;
6 | import com.drdg.netty.bean.InformationPacket;
7 | import com.drdg.netty.bean.InformationPacket.Group;
8 | import com.drdg.netty.service.MsgHandleService;
9 |
10 | import io.netty.channel.ChannelHandlerAdapter;
11 | import io.netty.channel.ChannelHandlerContext;
12 |
13 | public class TimeClientHandler extends ChannelHandlerAdapter{
14 |
15 | private static final Logger logger = Logger.getLogger(TimeClientHandler.class.getName());
16 |
17 | @Override
18 | public void channelActive(ChannelHandlerContext ctx) throws Exception {
19 |
20 | MsgHandleService.channel = ctx;
21 |
22 | }
23 |
24 | @Override
25 | public void channelRead(ChannelHandlerContext ctx, Object msg)
26 | throws Exception {
27 |
28 | InformationPacket.Group group = (Group) msg;
29 |
30 | MsgHandleService.doMsgForShunt(group);
31 | }
32 |
33 | @Override
34 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
35 | throws Exception {
36 | super.exceptionCaught(ctx, cause);
37 | }
38 |
39 |
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/control/CoreBusinessControl.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.control;
2 |
3 | import java.util.List;
4 | import java.util.concurrent.ExecutorService;
5 | import java.util.concurrent.Executors;
6 |
7 | import io.netty.channel.socket.SocketChannel;
8 |
9 | import com.drdg.netty.agreement.MsgAgreement;
10 | import com.drdg.netty.bean.InformationPacket.MsgInfo;
11 | import com.drdg.netty.bean.UserBean;
12 | import com.drdg.netty.bean.InformationPacket.Login;
13 | import com.drdg.netty.bean.InformationPacket.Group.User;
14 | import com.drdg.netty.client.NettyClient;
15 | import com.drdg.netty.service.MsgHandleService;
16 | import com.drdg.netty.thread.ClientThreadPool;
17 | import com.drdg.netty.view.GroupChat;
18 | import com.drdg.netty.view.MM;
19 |
20 | public class CoreBusinessControl {
21 |
22 | private MM mm;
23 | private GroupChat groupChat;
24 | private ExecutorService es = Executors.newCachedThreadPool();// 线程池
25 | private ClientThreadPool clientThread;
26 | private UserBean userBean;
27 |
28 | private CoreBusinessControl() {
29 | };
30 |
31 | public CoreBusinessControl(MM mm) {
32 | this.mm = mm;
33 | }
34 |
35 | /**
36 | * 校验登录
37 | */
38 | public void doCheckConnectLogin(String userName,String userPwd) {
39 |
40 | doConnectServer();
41 |
42 | userBean = new UserBean();
43 | userBean.setUserName(userName);
44 | userBean.setUserPwd(userPwd);
45 |
46 | }
47 |
48 | public void doCheckLogin(){
49 | MsgHandleService.doCheckLogin(userBean);
50 | }
51 |
52 | /**
53 | *
54 | * @param infoMsg
55 | */
56 | public void doSendMsg(String msgStr){
57 |
58 | MsgHandleService.doSendMsgStr(userBean.getUserName(), msgStr);
59 | }
60 |
61 | /**
62 | *
63 | * @param login
64 | */
65 | public void doChangeGroupChatView(Login login){
66 | mm.dispose();
67 | groupChat = new GroupChat();
68 | groupChat.setUser(userBean);
69 | }
70 |
71 | /**
72 | *
73 | * @param userListList
74 | */
75 | public void doRefreshFriendList(List userListList){
76 | groupChat.refreshFriendsList(userListList);
77 | }
78 |
79 | /**
80 | * 连接服务端
81 | *
82 | * @return
83 | */
84 | public void doConnectServer() {
85 | clientThread = new ClientThreadPool();
86 | es.execute(clientThread);
87 | }
88 |
89 | /**
90 | * 开启聊天界面
91 | */
92 | public void doOpenChatView() {
93 | mm.dispose();
94 | groupChat = new GroupChat();
95 | }
96 |
97 | /**
98 | *
99 | * @param msgInfo
100 | */
101 | public void doReceivedMsgInfo(MsgInfo msgInfo) {
102 | groupChat.refreshReceivedMsg(msgInfo);
103 | }
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/service/MsgHandleService.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.service;
2 |
3 | import java.util.List;
4 |
5 | import io.netty.channel.ChannelHandlerContext;
6 |
7 | import com.drdg.netty.agreement.MsgAgreement;
8 | import com.drdg.netty.bean.InformationPacket;
9 | import com.drdg.netty.bean.InformationPacket.Group.ServerConnectEnum;
10 | import com.drdg.netty.bean.InformationPacket.Group.User;
11 | import com.drdg.netty.bean.InformationPacket.Login;
12 | import com.drdg.netty.bean.InformationPacket.Login.LoinEnum;
13 | import com.drdg.netty.bean.InformationPacket.MsgInfo;
14 | import com.drdg.netty.bean.UserBean;
15 | import com.drdg.netty.control.CoreBusinessControl;
16 |
17 | public class MsgHandleService {
18 |
19 | public static ChannelHandlerContext channel;
20 | public static CoreBusinessControl coreBusinessControl;
21 | private static MsgAgreement msgAgree = new MsgAgreement(true);
22 |
23 | static public void doMsgForShunt(InformationPacket.Group group){
24 |
25 | switch (group.getMsgEnum().getNumber()) {
26 | //连接服务端反馈
27 | case InformationPacket.MsgEnum.ReuqestToConnect_VALUE:
28 |
29 | NoticeConnectState(group.getServerConnectEnum());
30 |
31 | break;
32 | case InformationPacket.MsgEnum.CheckToLogin_VALUE:
33 |
34 | NoticeLoginState(group.getLogin().getLoginState(),group.getLogin());
35 |
36 | break;
37 | case InformationPacket.MsgEnum.ChatOneToOne_VALUE:
38 |
39 | break;
40 | case InformationPacket.MsgEnum.ChatOneToAll_VALUE:
41 | NoticeReceivedMsgInfo(group.getMsgInfo());
42 | break;
43 | case InformationPacket.MsgEnum.ChatToFriend_VALUE:
44 |
45 | NoticeRefreshFriendsList(group.getUserListList());
46 |
47 | System.out.println("收到群消息");
48 |
49 | break;
50 | default:
51 | break;
52 | }
53 |
54 | }
55 |
56 | /**
57 | *
58 | * @param msgInfo
59 | */
60 | private static void NoticeReceivedMsgInfo(MsgInfo msgInfo) {
61 |
62 | coreBusinessControl.doReceivedMsgInfo(msgInfo);
63 |
64 | }
65 |
66 | /**
67 | *
68 | * @param userListList
69 | */
70 | private static void NoticeRefreshFriendsList(List userListList) {
71 | coreBusinessControl.doRefreshFriendList(userListList);
72 | }
73 |
74 | /**
75 | * 通知登录状态
76 | * @param loginState
77 | * @param login
78 | */
79 | private static void NoticeLoginState(LoinEnum loginState, Login login) {
80 |
81 | if(loginState == Login.LoinEnum.Success){
82 | coreBusinessControl.doChangeGroupChatView(login);
83 | }else{
84 |
85 | }
86 |
87 | }
88 |
89 | /**
90 | * 通知连接状态
91 | * @param serverConnectEnum
92 | */
93 | private static void NoticeConnectState(ServerConnectEnum serverConnectEnum) {
94 | System.out.println("发送登录信息"+serverConnectEnum);
95 | if(serverConnectEnum == InformationPacket.Group.ServerConnectEnum.Success){
96 | coreBusinessControl.doCheckLogin();
97 | System.out.println("发送登录信息");
98 | }else{
99 |
100 | }
101 |
102 | }
103 |
104 | static public void doCheckLogin(UserBean user){
105 | channel.writeAndFlush(msgAgree.doGetLoginInfoPacket(user.getUserName(), user.getUserPwd()));
106 | }
107 |
108 |
109 | static public void doSendMsgStr(String userName,String msgStr){
110 | channel.writeAndFlush(msgAgree.doGetGroupSendInfoPacket(userName, msgStr));
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/thread/ClientThreadPool.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.thread;
2 |
3 | import com.drdg.netty.client.NettyClient;
4 |
5 | public class ClientThreadPool implements Runnable{
6 |
7 | public void run() {
8 |
9 | String inetHost = "127.0.0.1";
10 | int inetPort = 7397;
11 |
12 | NettyClient nc = new NettyClient();
13 | try {
14 | nc.connect(inetPort, inetHost);
15 | } catch (Exception e) {
16 | e.printStackTrace();
17 | }
18 |
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/view/GroupChat.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.view;
2 |
3 | import java.awt.Color;
4 | import java.awt.Cursor;
5 | import java.awt.Dimension;
6 | import java.awt.Font;
7 | import java.awt.GraphicsEnvironment;
8 | import java.awt.GridLayout;
9 | import java.awt.Point;
10 | import java.awt.Toolkit;
11 | import java.awt.event.ActionEvent;
12 | import java.awt.event.ActionListener;
13 | import java.awt.event.InputEvent;
14 | import java.awt.event.KeyEvent;
15 | import java.awt.event.KeyListener;
16 | import java.awt.event.MouseEvent;
17 | import java.awt.event.MouseListener;
18 | import java.awt.event.MouseMotionListener;
19 | import java.util.List;
20 |
21 | import javax.swing.JFrame;
22 | import javax.swing.JLabel;
23 | import javax.swing.JPanel;
24 | import javax.swing.JScrollPane;
25 | import javax.swing.JTextPane;
26 | import javax.swing.text.BadLocationException;
27 | import javax.swing.text.DefaultStyledDocument;
28 | import javax.swing.text.MutableAttributeSet;
29 | import javax.swing.text.SimpleAttributeSet;
30 | import javax.swing.text.Style;
31 | import javax.swing.text.StyleConstants;
32 | import javax.swing.text.StyleContext;
33 | import javax.swing.text.StyledDocument;
34 |
35 | import com.drdg.netty.bean.InformationPacket.MsgInfo;
36 | import com.drdg.netty.bean.InformationPacket.Group.User;
37 | import com.drdg.netty.bean.UserBean;
38 | import com.drdg.netty.control.CoreBusinessControl;
39 | import com.drdg.netty.service.MsgHandleService;
40 |
41 | public class GroupChat extends JFrame implements ActionListener, MouseListener,
42 | MouseMotionListener, KeyListener {
43 |
44 | private UserBean userBean;
45 |
46 | public UserBean getUser() {
47 | return userBean;
48 | }
49 |
50 | public void setUser(UserBean userBean) {
51 | jlLoginUser.setText(userBean.getUserName());
52 | this.userBean = userBean;
53 | }
54 |
55 | public void refreshFriendsList(List userList) {
56 |
57 | jpFl.removeAll();
58 |
59 | for (User user : userList) {
60 | jlFriend = new JLabel(user.getId() + " " + user.getUserName());
61 | jlFriend.setFont(new Font("微软雅黑", 1, 12));
62 | jlFriend.addMouseListener(this);
63 |
64 | jpFl.add(jlFriend);
65 | jpFl.updateUI();
66 | jpFl.invalidate();
67 | jpFl.validate();
68 | jpFl.repaint();
69 | }
70 |
71 | }
72 |
73 | public void refreshReceivedMsg(MsgInfo msgInfo) {
74 | try {
75 | if(msgInfo.getSendUser().equals(userBean.getUserName())){
76 | styledDoc.insertString(styledDoc.getLength(),
77 | msgInfo.getSendUser()+"\r\n", styledDoc.getStyle("Style08"));
78 | styledDoc.insertString(styledDoc.getLength(), "\t"
79 | + msgInfo.getSendInfo() + "\r\n",
80 | styledDoc.getStyle("Style01"));
81 | }else{
82 | styledDoc.insertString(styledDoc.getLength(),
83 | msgInfo.getSendUser()+"\r\n", styledDoc.getStyle("Style02"));
84 | styledDoc.insertString(styledDoc.getLength(), "\t"
85 | + msgInfo.getSendInfo() + "\r\n",
86 | styledDoc.getStyle("Style01"));
87 | }
88 |
89 | jtpChat.setCaretPosition(jtpChat.getDocument().getLength());
90 | } catch (BadLocationException e) {
91 | e.printStackTrace();
92 | }
93 | }
94 |
95 | public void createStyle(String style, StyledDocument doc, int size,
96 | int bold, int italic, int underline, Color color, String fontName) {
97 | Style sys = StyleContext.getDefaultStyleContext().getStyle(
98 | StyleContext.DEFAULT_STYLE);
99 | try {
100 | doc.removeStyle(style);
101 | } catch (Exception e) {
102 | } // 先删除这种Style,假使他存在
103 |
104 | Style s = doc.addStyle(style, sys); // 加入
105 | StyleConstants.setFontSize(s, size); // 大小
106 | StyleConstants.setBold(s, (bold == 1) ? true : false); // 粗体
107 | StyleConstants.setItalic(s, (italic == 1) ? true : false); // 斜体
108 | StyleConstants.setUnderline(s, (underline == 1) ? true : false); // 下划线
109 | StyleConstants.setForeground(s, color); // 颜色
110 | StyleConstants.setFontFamily(s, fontName); // 字体
111 | }
112 |
113 |
114 | @Override
115 | public void mouseClicked(MouseEvent arg0) {
116 |
117 | }
118 |
119 | @Override
120 | public void mouseEntered(MouseEvent arg0) {
121 |
122 | }
123 |
124 | @Override
125 | public void mouseExited(MouseEvent e) {
126 |
127 | }
128 |
129 | @Override
130 | public void mousePressed(MouseEvent e) {
131 | if (e.getSource() == jpBack) {
132 | // 当鼠标按下的时候获得窗口当前的位置
133 | origin.x = e.getX();
134 | origin.y = e.getY();
135 | }
136 |
137 | }
138 |
139 | @Override
140 | public void mouseReleased(MouseEvent arg0) {
141 |
142 | }
143 |
144 | @Override
145 | public void actionPerformed(ActionEvent arg0) {
146 |
147 | }
148 |
149 | @Override
150 | public void mouseDragged(MouseEvent e) {
151 | if (e.getSource() == jpBack) {
152 | Point p = this.getLocation();
153 | this.setLocation(p.x + e.getX() - origin.x, p.y + e.getY()
154 | - origin.y);
155 | }
156 |
157 | }
158 |
159 | @Override
160 | public void mouseMoved(MouseEvent e) {
161 |
162 | }
163 |
164 | @Override
165 | public void keyPressed(KeyEvent e) {
166 | if (e.getModifiers() == InputEvent.CTRL_MASK
167 | && e.getKeyCode() == KeyEvent.VK_ENTER) {
168 | MsgHandleService.coreBusinessControl.doSendMsg(jtpInChat.getText());
169 | jtpInChat.setText("");
170 | }
171 | }
172 |
173 | @Override
174 | public void keyReleased(KeyEvent e) {
175 | // TODO Auto-generated method stub
176 |
177 | }
178 |
179 | @Override
180 | public void keyTyped(KeyEvent e) {
181 | // TODO Auto-generated method stub
182 |
183 | }
184 |
185 | public GroupChat() {
186 | // 背景设置
187 | jpBack = new JPanel(null);
188 | jpBack.setSize(600, 500);
189 | jpBack.setLocation(0, 0);
190 | jpBack.setBackground(Color.gray);
191 | jpBack.addMouseListener(this);
192 | jpBack.addMouseMotionListener(this);
193 | this.add(jpBack);
194 |
195 | // 顶部菜单
196 | jpTopMenu = new JPanel(null);
197 | jpTopMenu.setSize(600, 30);
198 | jpTopMenu.setLocation(0, 0);
199 | jpTopMenu.setBackground(Color.DARK_GRAY);
200 | jpBack.add(jpTopMenu);
201 |
202 | jlLoginUser = new JLabel();
203 | jlLoginUser.setForeground(Color.white);
204 | jlLoginUser.setFont(new Font("微软雅黑", 1, 12));
205 | jlLoginUser.setSize(50, 20);
206 | jlLoginUser.setLocation(10, 10);
207 | jpTopMenu.add(jlLoginUser);
208 |
209 | jlMini = new JLabel("Mini");
210 | jlMini.setForeground(Color.white);
211 | jlMini.setCursor(new Cursor(Cursor.HAND_CURSOR));
212 | jlMini.setSize(25, 20);
213 | jlMini.setLocation(538, 10);
214 | jpTopMenu.add(jlMini);
215 |
216 | jlExit = new JLabel("Exit");
217 | jlExit.setForeground(Color.red);
218 | jlExit.setCursor(new Cursor(Cursor.HAND_CURSOR));
219 | jlExit.setSize(25, 20);
220 | jlExit.setLocation(568, 10);
221 | jpTopMenu.add(jlExit);
222 |
223 | // 聊天面板
224 | jtpChat = new JTextPane(styledDoc);
225 | jspChat = new JScrollPane(jtpChat);
226 | jspChat.setSize(400, 320);
227 | jspChat.setLocation(10, 40);
228 | jpBack.add(jspChat);
229 |
230 | // 功能栏
231 | jpFunction = new JPanel(null);
232 | jpFunction.setSize(400, 30);
233 | jpFunction.setLocation(10, 370);
234 | jpBack.add(jpFunction);
235 |
236 | // 聊天信息输入
237 | jtpInChat = new JTextPane();
238 | jtpInChat.setSize(400, 80);
239 | jtpInChat.setLocation(10, 410);
240 | jtpInChat.addKeyListener(this);
241 | jpBack.add(jtpInChat);
242 |
243 | // 好友列表
244 | jpFriendList = new JPanel(null);
245 | jpFriendList.setSize(170, 450);
246 | jpFriendList.setLocation(420, 40);
247 | jpBack.add(jpFriendList);
248 |
249 | jpFl = new JPanel(new GridLayout(20, 1));
250 | jspFl = new JScrollPane(jpFl);
251 | jspFl.setSize(168, 420);
252 | jspFl.setLocation(2, 30);
253 | jpFriendList.add(jspFl);
254 |
255 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
256 | int width = screenSize.width;
257 | int height = screenSize.height;
258 |
259 | this.setLayout(null);
260 | this.setUndecorated(true);
261 | this.setBackground(Color.blue);
262 | this.setLocation(width / 2 - 300, height / 2 - 250);
263 | this.setSize(600, 500);
264 | this.setResizable(false);
265 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
266 | this.setVisible(true);
267 |
268 | // Content
269 | createStyle("Style01", styledDoc, 12, 0, 1, 0, Color.BLACK, "微软雅黑");
270 | createStyle("Style02", styledDoc, 14, 1, 1, 1, Color.GREEN, "微软雅黑");
271 | createStyle("Style03", styledDoc, 25, 1, 0, 0, Color.BLUE, "隶书");
272 | createStyle("Style04", styledDoc, 18, 1, 0, 0, new Color(0, 128, 128),
273 | fontNames[0]);
274 | createStyle("Style05", styledDoc, 20, 0, 1, 0, new Color(128, 128, 0),
275 | fontNames[7]);
276 | createStyle("Style06", styledDoc, 22, 1, 0, 1, new Color(128, 0, 128),
277 | fontNames[16]);
278 | createStyle("Style07", styledDoc, 14, 1, 1, 0, Color.RED, "华文彩云");
279 | createStyle("Style08", styledDoc, 12, 0, 1, 0, Color.blue, "微软雅黑");
280 |
281 | }
282 |
283 | private JLabel jlLoginUser, jlExit, jlMini, jlFriend;
284 |
285 | private JPanel jpBack, jpTopMenu, jpFunction, jpFriendList, jpFl;
286 |
287 | private JTextPane jtpChat, jtpInChat;
288 |
289 | private JScrollPane jspChat, jspFl;
290 |
291 | private StyledDocument styledDoc = new DefaultStyledDocument();
292 |
293 | String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment()
294 | .getAvailableFontFamilyNames();
295 |
296 | private Point origin = new Point();
297 |
298 | }
299 |
--------------------------------------------------------------------------------
/TestNettyClient/src/com/drdg/netty/view/MM.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.view;
2 |
3 | import java.awt.Color;
4 | import java.awt.Cursor;
5 | import java.awt.Dimension;
6 | import java.awt.Font;
7 | import java.awt.Point;
8 | import java.awt.Toolkit;
9 | import java.awt.event.ActionEvent;
10 | import java.awt.event.ActionListener;
11 | import java.awt.event.MouseEvent;
12 | import java.awt.event.MouseListener;
13 | import java.awt.event.MouseMotionListener;
14 |
15 | import javax.swing.ImageIcon;
16 | import javax.swing.JButton;
17 | import javax.swing.JFrame;
18 | import javax.swing.JLabel;
19 | import javax.swing.JPanel;
20 | import javax.swing.JPasswordField;
21 | import javax.swing.JTextField;
22 | import javax.swing.border.Border;
23 | import javax.swing.border.EmptyBorder;
24 |
25 | import com.drdg.netty.control.CoreBusinessControl;
26 | import com.drdg.netty.service.MsgHandleService;
27 |
28 | public class MM extends JFrame implements ActionListener,MouseListener,MouseMotionListener{
29 |
30 | private static CoreBusinessControl coreBusinessConntrol;
31 |
32 | public static void main(String[] args) {
33 |
34 | MM mm = new MM();
35 | coreBusinessConntrol = new CoreBusinessControl(mm);
36 | MsgHandleService.coreBusinessControl = coreBusinessConntrol;
37 | }
38 |
39 | /**
40 | * 构造函数
41 | */
42 | public MM(){
43 |
44 | //JLabel
45 | lblTop = new JLabel(new ImageIcon("resources/LoginUi/morning.jpg"));
46 | lblTop.setSize(430, 184);
47 | lblTop.setLocation(0, 0);
48 | lblTop.addMouseMotionListener(this);
49 |
50 | lblTopClose = new JLabel(new ImageIcon("resources/LoginUi/close.png"));
51 | lblTopClose.setSize(12, 12);
52 | lblTopClose.setLocation(415, 2);
53 | lblTopClose.addMouseListener(this);
54 | lblTop.add(lblTopClose);
55 |
56 | this.add(lblTop);
57 |
58 | //Center
59 | pnlCenter = new JPanel(null);
60 | pnlCenter.setSize(430, 146);
61 | pnlCenter.setLocation(0, 184);
62 | pnlCenter.setBackground(new Color(235,242,249));
63 | this.add(pnlCenter);
64 |
65 | //二维码
66 | lblBottom = new JLabel(new ImageIcon("resources/LoginUi/generate.png"));
67 | lblBottom.setSize(74,74);
68 | lblBottom.setLocation(356, 70);
69 | pnlCenter.add(lblBottom);
70 |
71 | lblBottomVersion = new JLabel("V1.0");
72 | lblBottomVersion.setSize(30,15);
73 | lblBottomVersion.setLocation(2, 130);
74 | lblBottomVersion.setFont(new Font("微软雅黑",Font.BOLD,12));
75 | lblBottomVersion.setForeground(Color.GRAY);
76 | pnlCenter.add(lblBottomVersion);
77 |
78 | //头像
79 | lblCenter = new JLabel(new ImageIcon("resources/LoginUi/head.png"));
80 | lblCenter.setSize(80, 80);
81 | lblCenter.setLocation(40, 15);
82 | pnlCenter.add(lblCenter);
83 | //用户名
84 | lblJtfUserName = new JLabel(new ImageIcon("resources/LoginUi/edit_frame_normal_reversed.png"));
85 | lblJtfUserName.setSize(194, 30);
86 | lblJtfUserName.setLocation(136, 25);
87 | pnlCenter.add(lblJtfUserName);
88 |
89 | lblJtfUserImg = new JLabel(new ImageIcon("resources/LoginUi/user.png"));
90 | lblJtfUserImg.setSize(30, 30);
91 | lblJtfUserImg.setLocation(165, 0);
92 | lblJtfUserName.add(lblJtfUserImg);
93 |
94 | jtfUserName = new JTextField();
95 | jtfUserName.setBorder(new EmptyBorder(0, 0, 0, 0));
96 | jtfUserName.setOpaque(false);
97 | jtfUserName.setSize(165, 30);
98 | jtfUserName.setLocation(2, 0);
99 | jtfUserName.addMouseListener(this);
100 | lblJtfUserName.add(jtfUserName);
101 |
102 | //密码
103 | lblJpfPassword = new JLabel(new ImageIcon("resources/LoginUi/edit_frame_normal.png"));
104 | lblJpfPassword.setSize(194, 30);
105 | lblJpfPassword.setLocation(136, 55);
106 | pnlCenter.add(lblJpfPassword);
107 |
108 | lblJtfPwdImg = new JLabel(new ImageIcon("resources/LoginUi/pwd.png"));
109 | lblJtfPwdImg.setSize(30, 30);
110 | lblJtfPwdImg.setLocation(165, 0);
111 | lblJpfPassword.add(lblJtfPwdImg);
112 |
113 | jpfPassword = new JPasswordField();
114 | jpfPassword.setBorder(new EmptyBorder(0, 0, 0, 0));
115 | jpfPassword.setOpaque(false);
116 | jpfPassword.setSize(165, 30);
117 | jpfPassword.setLocation(2, 0);
118 | jpfPassword.addMouseListener(this);
119 | lblJpfPassword.add(jpfPassword);
120 |
121 | //登录
122 | jbLogin = new JButton(new ImageIcon("resources/LoginUi/button_login_normal.png"));
123 | jbLogin.setLayout(null);
124 | jbLogin.setBorder(new EmptyBorder(0, 0, 0, 0));
125 | jbLogin.setSize(194, 30);
126 | jbLogin.setLocation(136, 110);
127 | jbLogin.setCursor(new Cursor(Cursor.HAND_CURSOR));
128 | jbLogin.addActionListener(this);
129 | jbLogin.addMouseListener(this);
130 | pnlCenter.add(jbLogin);
131 |
132 | lblJbLogin = new JLabel("登 录");
133 | lblJbLogin.setFont(new Font("微软雅黑",Font.BOLD,12));
134 | lblJbLogin.setForeground(Color.white);
135 | lblJbLogin.setLocation(85, 0);
136 | lblJbLogin.setSize(30, 30);
137 | jbLogin.add(lblJbLogin);
138 |
139 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
140 | int width = screenSize.width;
141 | int height = screenSize.height;
142 |
143 | this.setLayout(null);
144 | this.setUndecorated(true);
145 | this.setLocation(width / 2 - 215 , height / 2 - 165);
146 | this.setSize(430, 330);
147 | this.setResizable(false);
148 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
149 | this.setVisible(true);
150 |
151 | }
152 |
153 | private JPanel pnlCenter;
154 |
155 | private JLabel lblTop,lblTopClose,
156 | lblCenter,lblJtfUserName,lblJpfPassword,lblJtfUserImg,lblJtfPwdImg,
157 | lblJbLogin,
158 | lblBottom,lblBottomVersion;
159 |
160 | private JTextField jtfUserName;
161 |
162 | private JPasswordField jpfPassword;
163 |
164 | private JButton jbLogin;
165 |
166 | private Point origin = new Point();
167 |
168 | /**
169 | * 事件
170 | */
171 | public void actionPerformed(ActionEvent arg0) {
172 | if(arg0.getSource() == jbLogin){
173 |
174 | coreBusinessConntrol.doCheckConnectLogin(jtfUserName.getText(),jpfPassword.getText());
175 |
176 | }
177 |
178 | }
179 |
180 | @Override
181 | public void mouseClicked(MouseEvent arg0) {
182 |
183 | }
184 |
185 | @Override
186 | public void mouseEntered(MouseEvent arg0) {
187 | if(arg0.getSource() == lblTopClose){
188 | lblTopClose.setIcon(new ImageIcon("resources/LoginUi/close_hover.png"));
189 | }
190 |
191 | if(arg0.getSource() == jtfUserName)
192 | {
193 | lblJtfUserName.setIcon(new ImageIcon("resources/LoginUi/edit_frame_hover_reversed.png"));
194 | }
195 |
196 | if(arg0.getSource() == jpfPassword)
197 | {
198 | lblJpfPassword.setIcon(new ImageIcon("resources/LoginUi/edit_frame_hover.png"));
199 | }
200 |
201 | if(arg0.getSource() == jbLogin){
202 | jbLogin.setIcon(new ImageIcon("resources/LoginUi/button_login_hover.png"));
203 | }
204 | }
205 |
206 | @Override
207 | public void mouseExited(MouseEvent arg0) {
208 | if(arg0.getSource() == lblTopClose){
209 | lblTopClose.setIcon(new ImageIcon("resources/LoginUi/close.png"));
210 | }
211 |
212 | if(arg0.getSource() == jtfUserName)
213 | {
214 | lblJtfUserName.setIcon(new ImageIcon("resources/LoginUi/edit_frame_normal_reversed.png"));
215 | }
216 |
217 | if(arg0.getSource() == jpfPassword)
218 | {
219 | lblJpfPassword.setIcon(new ImageIcon("resources/LoginUi/edit_frame_normal.png"));
220 | }
221 |
222 | if(arg0.getSource() == jbLogin){
223 | jbLogin.setIcon(new ImageIcon("resources/LoginUi/button_login_normal.png"));
224 | }
225 | }
226 |
227 | @Override
228 | public void mousePressed(MouseEvent arg0) {
229 |
230 | if(arg0.getSource() == lblTopClose){
231 | System.exit(0);
232 | }
233 |
234 | if(arg0.getSource() == jbLogin){
235 | jbLogin.setIcon(new ImageIcon("resources/LoginUi/button_login_down.png"));
236 | }
237 |
238 | if(arg0.getSource() == lblTop){
239 | // 当鼠标按下的时候获得窗口当前的位置
240 | origin.x = arg0.getX();
241 | origin.y = arg0.getY();
242 | }
243 | }
244 |
245 | @Override
246 | public void mouseReleased(MouseEvent arg0) {
247 |
248 | }
249 |
250 | @Override
251 | public void mouseDragged(MouseEvent arg0) {
252 | if (arg0.getSource() == lblTop) {
253 | Point p = this.getLocation();
254 | this.setLocation(p.x + arg0.getX() - origin.x, p.y + arg0.getY()
255 | - origin.y);
256 | }
257 | }
258 |
259 | @Override
260 | public void mouseMoved(MouseEvent arg0) {
261 | }
262 |
263 | }
264 |
265 |
266 |
--------------------------------------------------------------------------------
/TestNettyServer/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TestNettyServer/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | TestNettyServer
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/TestNettyServer/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/TestNettyServer/bin/.gitignore:
--------------------------------------------------------------------------------
1 | /com/
2 |
--------------------------------------------------------------------------------
/TestNettyServer/lib/netty-all-5.0.0.Alpha1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyServer/lib/netty-all-5.0.0.Alpha1.jar
--------------------------------------------------------------------------------
/TestNettyServer/lib/protobuf-java-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fuzhengwei/itstack-demo-nettychat/ab2110f4d9af04606e04d31cd35c691f7a2c6be3/TestNettyServer/lib/protobuf-java-2.5.0.jar
--------------------------------------------------------------------------------
/TestNettyServer/proto/info.proto:
--------------------------------------------------------------------------------
1 | option java_package = "com.drdg.netty.bean";
2 | option java_outer_classname = "InformationPacket";
3 |
4 | message Group{
5 | required MsgEnum msgEnum = 1;
6 | required Login login = 2;
7 | required MsgInfo msgInfo = 3;
8 | required ServerConnectEnum serverConnectEnum = 4;
9 | repeated User userList = 5;
10 |
11 | enum ServerConnectEnum{
12 | Request = 1;
13 | Success = 2;
14 | Failure = 3;
15 | }
16 |
17 | message User{
18 | required string id = 1;
19 | required string userName = 2;
20 | required string userPwd = 3;
21 | }
22 | }
23 |
24 |
25 | message Login{
26 | required string userName = 1;
27 | required string userPwd = 2;
28 | required LoinEnum loginState = 3;
29 | required string feedBackInfo = 4;
30 |
31 | enum LoinEnum{
32 |
33 | Request = 1;
34 | Success = 2;
35 | Failure = 3;
36 |
37 | }
38 | }
39 |
40 | message MsgInfo{
41 | required string sendUser = 1;
42 | required string sendToUser = 2;
43 | required string sendInfo = 3;
44 | }
45 |
46 | enum MsgEnum{
47 |
48 | ReuqestToConnect = 1;
49 | CheckToLogin = 2;
50 | ChatOneToOne = 3;
51 | ChatOneToAll = 4;
52 | ChatToFriend = 5;
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/TestNettyServer/src/com/drdg/netty/agreement/MsgAgreement.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.agreement;
2 |
3 | import java.util.Collection;
4 | import java.util.Collections;
5 | import java.util.List;
6 |
7 | import com.drdg.netty.bean.InformationPacket;
8 | import com.drdg.netty.bean.InformationPacket.Group.User;
9 |
10 | public class MsgAgreement {
11 |
12 | private InformationPacket.Group group;
13 | private InformationPacket.Login login;
14 | private InformationPacket.MsgInfo msgInfo;
15 | private InformationPacket.Group.User user;
16 |
17 | @SuppressWarnings("unused")
18 | private MsgAgreement(){}
19 |
20 | public MsgAgreement(boolean bool){
21 |
22 | if(bool){
23 |
24 | login = InformationPacket.Login.newBuilder()
25 | .setUserName("")
26 | .setUserPwd("")
27 | .setLoginState(InformationPacket.Login.LoinEnum.Request)
28 | .setFeedBackInfo("")
29 | .build();
30 |
31 | msgInfo = InformationPacket.MsgInfo.newBuilder()
32 | .setSendUser("")
33 | .setSendToUser("")
34 | .setSendInfo("")
35 | .build();
36 |
37 | user = InformationPacket.Group.User.newBuilder()
38 | .setId("")
39 | .setUserName("")
40 | .setUserPwd("")
41 | .build();
42 |
43 |
44 | group = InformationPacket.Group.newBuilder()
45 | .setLogin(login)
46 | .setMsgInfo(msgInfo)
47 | .setMsgEnum(InformationPacket.MsgEnum.ReuqestToConnect)
48 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Request)
49 | .addUserList(user)
50 | .build();
51 |
52 |
53 | }
54 |
55 | }
56 |
57 | /**
58 | * get connect server agreement Group
59 | * @param serverConnectEnum
60 | * @return
61 | */
62 | public InformationPacket.Group doGetConnectServerInfoPacket(InformationPacket.Group.ServerConnectEnum serverConnectEnum){
63 | group = InformationPacket.Group.newBuilder()
64 | .setLogin(login)
65 | .setMsgInfo(msgInfo)
66 | .setMsgEnum(InformationPacket.MsgEnum.ReuqestToConnect)
67 | .setServerConnectEnum(serverConnectEnum)
68 | .addUserList(user)
69 | .build();
70 |
71 | return group;
72 | }
73 |
74 | /**
75 | * get login agreement Group
76 | * @param userName
77 | * @param userPwd
78 | * @return InformationPacket.Group
79 | */
80 | public InformationPacket.Group doGetLoginInfoPacket(String userName,String userPwd){
81 |
82 | InformationPacket.Login login = InformationPacket.Login.newBuilder()
83 | .setUserName(userName)
84 | .setUserPwd(userPwd)
85 | .setLoginState(InformationPacket.Login.LoinEnum.Request)
86 | .setFeedBackInfo("")
87 | .build();
88 |
89 | group = InformationPacket.Group.newBuilder()
90 | .setLogin(login)
91 | .setMsgInfo(msgInfo)
92 | .setMsgEnum(InformationPacket.MsgEnum.CheckToLogin)
93 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success)
94 | .addUserList(user)
95 | .build();
96 |
97 | return group;
98 |
99 | }
100 |
101 | /**
102 | * get checked login agreement Group
103 | * @param userName
104 | * @param userPwd
105 | * @param loginEnum
106 | * @param feedBackInfo
107 | * @return
108 | */
109 | public InformationPacket.Group doGetLoginInfoPacket(String userName,String userPwd,InformationPacket.Login.LoinEnum loginEnum,String feedBackInfo){
110 |
111 |
112 | InformationPacket.Login login = InformationPacket.Login.newBuilder()
113 | .setUserName(userName)
114 | .setUserPwd(userPwd)
115 | .setLoginState(loginEnum)
116 | .setFeedBackInfo(feedBackInfo)
117 | .build();
118 |
119 | group = InformationPacket.Group.newBuilder()
120 | .setLogin(login)
121 | .setMsgInfo(msgInfo)
122 | .setMsgEnum(InformationPacket.MsgEnum.CheckToLogin)
123 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success)
124 | .addUserList(user)
125 | .build();
126 |
127 | return group;
128 |
129 | }
130 |
131 | /**
132 | * get chat friends list
133 | * @param userList
134 | * @return
135 | */
136 | public InformationPacket.Group doGetChatFriendsListInfoPacket(Collection userList){
137 |
138 | InformationPacket.Group.Builder groupBuilder = InformationPacket.Group.newBuilder();
139 | groupBuilder.setLogin(login);
140 | groupBuilder.setMsgInfo(msgInfo);
141 | groupBuilder.setMsgEnum(InformationPacket.MsgEnum.ChatToFriend);
142 | groupBuilder.setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success);
143 | for (User user : userList) {
144 | groupBuilder.addUserList(user);
145 | }
146 | group = groupBuilder.build();
147 |
148 | return group;
149 | }
150 |
151 | /**
152 | * get group send info packet
153 | * @param userName
154 | * @param msgStr
155 | * @return
156 | */
157 | public InformationPacket.Group doGetGroupSendInfoPacket(String userName,String msgStr){
158 |
159 | msgInfo = InformationPacket.MsgInfo.newBuilder()
160 | .setSendUser(userName)
161 | .setSendToUser("")
162 | .setSendInfo(msgStr)
163 | .build();
164 |
165 | group = InformationPacket.Group.newBuilder()
166 | .setLogin(login)
167 | .setMsgInfo(msgInfo)
168 | .setMsgEnum(InformationPacket.MsgEnum.ChatOneToAll)
169 | .setServerConnectEnum(InformationPacket.Group.ServerConnectEnum.Success)
170 | .addUserList(user)
171 | .build();
172 |
173 | return group;
174 |
175 | }
176 |
177 | }
178 |
--------------------------------------------------------------------------------
/TestNettyServer/src/com/drdg/netty/server/ChildChannelHandler.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.server;
2 |
3 | import com.drdg.netty.agreement.MsgAgreement;
4 | import com.drdg.netty.bean.InformationPacket;
5 |
6 | import io.netty.buffer.ByteBuf;
7 | import io.netty.buffer.Unpooled;
8 | import io.netty.channel.ChannelInitializer;
9 | import io.netty.channel.group.ChannelGroup;
10 | import io.netty.channel.group.DefaultChannelGroup;
11 | import io.netty.channel.socket.SocketChannel;
12 | import io.netty.handler.codec.protobuf.ProtobufDecoder;
13 | import io.netty.handler.codec.protobuf.ProtobufEncoder;
14 | import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
15 | import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
16 | import io.netty.util.concurrent.GlobalEventExecutor;
17 |
18 | public class ChildChannelHandler extends ChannelInitializer {
19 |
20 | @Override
21 | protected void initChannel(SocketChannel sc) throws Exception {
22 |
23 | System.out.println("服务端开启... ...");
24 |
25 | sc.pipeline().addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
26 | sc.pipeline().addLast("protobufDecoder", new ProtobufDecoder(InformationPacket.Group.getDefaultInstance()));
27 | sc.pipeline().addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
28 | sc.pipeline().addLast("protobufEncoder", new ProtobufEncoder());
29 | sc.pipeline().addLast(new TimeServerHandler());
30 |
31 | //客户端连接
32 | System.out.println("客户端连接");
33 | System.out.println(sc.id());
34 |
35 | //发送连接成功包给客户端
36 | MsgAgreement msgAgreement = new MsgAgreement(true);
37 | sc.writeAndFlush(msgAgreement.doGetConnectServerInfoPacket(InformationPacket.Group.ServerConnectEnum.Success));
38 | System.out.println("向客户端发送连接消息包");
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/TestNettyServer/src/com/drdg/netty/server/NettyServer.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.server;
2 |
3 | import io.netty.bootstrap.ServerBootstrap;
4 | import io.netty.channel.ChannelFuture;
5 | import io.netty.channel.ChannelOption;
6 | import io.netty.channel.EventLoopGroup;
7 | import io.netty.channel.nio.NioEventLoopGroup;
8 | import io.netty.channel.socket.nio.NioServerSocketChannel;
9 |
10 | public class NettyServer {
11 |
12 |
13 | public void bing(int port) throws Exception{
14 |
15 | EventLoopGroup bossGroup = new NioEventLoopGroup();
16 | EventLoopGroup workerGroup = new NioEventLoopGroup();
17 |
18 | try {
19 |
20 | ServerBootstrap b = new ServerBootstrap();
21 |
22 | b.group(bossGroup, workerGroup);
23 | b.channel(NioServerSocketChannel.class);
24 | b.option(ChannelOption.SO_BACKLOG, 1024);
25 | b.childHandler(new ChildChannelHandler());
26 |
27 | //绑定端口
28 | ChannelFuture f = b.bind(port).sync();
29 |
30 | //等待服务端监听端口关闭
31 | f.channel().closeFuture().sync();
32 |
33 | } finally{
34 | bossGroup.shutdownGracefully();
35 | workerGroup.shutdownGracefully();
36 | }
37 |
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/TestNettyServer/src/com/drdg/netty/server/StartServer.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.server;
2 |
3 | public class StartServer {
4 |
5 |
6 |
7 | public static void main(String[] args) {
8 |
9 | int port = 7397;
10 |
11 | NettyServer ns = new NettyServer();
12 |
13 | try {
14 |
15 | ns.bing(port);
16 |
17 | } catch (Exception e) {
18 | e.printStackTrace();
19 | }
20 |
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/TestNettyServer/src/com/drdg/netty/server/TimeServerHandler.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.server;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import com.drdg.netty.agreement.MsgAgreement;
9 | import com.drdg.netty.bean.InformationPacket;
10 | import com.drdg.netty.bean.InformationPacket.Group;
11 | import com.drdg.netty.service.MsgHandleService;
12 |
13 | import io.netty.channel.ChannelHandlerAdapter;
14 | import io.netty.channel.ChannelHandlerContext;
15 | import io.netty.channel.group.ChannelGroup;
16 | import io.netty.channel.group.DefaultChannelGroup;
17 | import io.netty.util.concurrent.GlobalEventExecutor;
18 |
19 | public class TimeServerHandler extends ChannelHandlerAdapter {
20 |
21 | MsgAgreement msgAgree = new MsgAgreement(true);
22 |
23 | @Override
24 | public void channelActive(ChannelHandlerContext ctx) throws Exception {
25 |
26 | MsgHandleService.channelGroup.add(ctx.channel());
27 | MsgHandleService.userMap.put(ctx.channel().id().toString(), ctx);
28 |
29 | System.out.println("登录"+MsgHandleService.channelGroup.size());
30 | }
31 |
32 | @Override
33 | public void channelInactive(ChannelHandlerContext ctx) throws Exception {
34 | MsgHandleService.channelGroup.remove(ctx.channel());
35 | MsgHandleService.userMap.remove(ctx.channel().id().toString());
36 | MsgHandleService.userList.remove(ctx.channel().id().toString());
37 | System.out.println("退出");
38 | }
39 |
40 | @Override
41 | public void channelRead(ChannelHandlerContext ctx, Object msg)
42 | throws Exception {
43 |
44 | InformationPacket.Group group = (Group) msg;
45 |
46 | switch (group.getMsgEnum().getNumber()) {
47 | case InformationPacket.MsgEnum.CheckToLogin_VALUE:
48 | //登录
49 | InformationPacket.Login login = group.getLogin();
50 | //返回登录信息
51 | ctx.writeAndFlush(msgAgree.doGetLoginInfoPacket(login.getUserName(), login.getUserPwd(), InformationPacket.Login.LoinEnum.Success, "OK"));
52 | //组织好友列表信息
53 | InformationPacket.Group.User.Builder userBean = InformationPacket.Group.User.newBuilder();
54 | userBean.setId(ctx.channel().id().toString());
55 | userBean.setUserName(login.getUserName());
56 | userBean.setUserPwd("");
57 | MsgHandleService.userList.put(ctx.channel().id().toString(), userBean.build());
58 |
59 | //群发送好友列表
60 | MsgHandleService.channelGroup.writeAndFlush(msgAgree.doGetChatFriendsListInfoPacket(MsgHandleService.userList.values()));
61 |
62 | break;
63 | case InformationPacket.MsgEnum.ChatOneToOne_VALUE:
64 | //1v1
65 | break;
66 | case InformationPacket.MsgEnum.ChatOneToAll_VALUE:
67 | //1vn
68 | MsgHandleService.channelGroup.writeAndFlush(group);
69 | break;
70 | default:
71 | break;
72 | }
73 |
74 | }
75 |
76 | @Override
77 | public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
78 |
79 | ctx.flush();
80 | }
81 |
82 | @Override
83 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
84 | throws Exception {
85 | ctx.close();
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/TestNettyServer/src/com/drdg/netty/service/MsgHandleService.java:
--------------------------------------------------------------------------------
1 | package com.drdg.netty.service;
2 |
3 | import io.netty.channel.ChannelHandlerContext;
4 | import io.netty.channel.group.ChannelGroup;
5 | import io.netty.channel.group.DefaultChannelGroup;
6 | import io.netty.util.concurrent.GlobalEventExecutor;
7 |
8 | import java.util.ArrayList;
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | import com.drdg.netty.bean.InformationPacket;
14 |
15 | public class MsgHandleService {
16 |
17 | public static ChannelGroup channelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
18 |
19 | public static Map userMap = new HashMap();
20 |
21 | public static Map userList = new HashMap();
22 |
23 | }
24 |
--------------------------------------------------------------------------------