From 3117a833162bed9081a34f497cc2ce58e1b2b02f Mon Sep 17 00:00:00 2001 From: zhengpengfei <15832183435@163.com> Date: Tue, 3 Dec 2019 23:55:24 +0800 Subject: [PATCH 01/13] niodemo --- .idea/compiler.xml | 13 + .idea/encodings.xml | 6 + .idea/misc.xml | 14 + .idea/uiDesigner.xml | 124 +++++ .idea/workspace.xml | 474 ++++++++++++++++++ MyNetty.iml | 2 + pom.xml | 121 +++++ .../java/com/zpf/three/NioSendClient.java | 37 ++ src/main/java/config/ZConfig.java | 63 +++ src/main/java/util/IOUtil.java | 39 ++ src/main/resources/system.properties | 9 + src/test/java/Test.java | 7 + target/classes/META-INF/MyNetty.kotlin_module | Bin 0 -> 16 bytes .../classes/com/zpf/three/NioSendClient.class | Bin 0 -> 984 bytes target/classes/config/ZConfig.class | Bin 0 -> 2329 bytes target/classes/system.properties | 9 + target/classes/util/IOUtil.class | Bin 0 -> 1554 bytes target/test-classes/Test.class | Bin 0 -> 567 bytes 18 files changed, 918 insertions(+) create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/workspace.xml create mode 100644 MyNetty.iml create mode 100644 pom.xml create mode 100644 src/main/java/com/zpf/three/NioSendClient.java create mode 100644 src/main/java/config/ZConfig.java create mode 100644 src/main/java/util/IOUtil.java create mode 100644 src/main/resources/system.properties create mode 100644 src/test/java/Test.java create mode 100644 target/classes/META-INF/MyNetty.kotlin_module create mode 100644 target/classes/com/zpf/three/NioSendClient.class create mode 100644 target/classes/config/ZConfig.class create mode 100644 target/classes/system.properties create mode 100644 target/classes/util/IOUtil.class create mode 100644 target/test-classes/Test.class diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b4ddc0c --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e79da7e --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4b661a5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..629e7e6 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getPeopert + + + getProperty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - + + + + + + + + + - + + + + + - @@ -321,135 +427,520 @@ - - - - - - - - - - - - - - - - + + + + + + + - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + file://$PROJECT_DIR$/src/main/java/com/zpf/three/NioReceiveServer.java + 103 + + + + file://$PROJECT_DIR$/src/main/java/com/zpf/three/NioSendClient.java + 48 + + + + file://$PROJECT_DIR$/src/main/java/com/zpf/three/NioReceiveServer.java + 127 + + + + + - + - - + + - + - - + + - + - + - - + + - + - - + + - + - - + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JAVA + java.nio.channels.FileChannel + + java.nio.channels.SeekableByteChannel + java.nio.channels.ScatteringByteChannel + java.nio.channels.ReadableByteChannel + java.nio.channels.InterruptibleChannel + java.io.Closeable + java.nio.channels.WritableByteChannel + java.nio.channels.ByteChannel + java.nio.channels.spi.AbstractInterruptibleChannel + java.nio.channels.FileChannel + java.lang.AutoCloseable + java.nio.channels.GatheringByteChannel + java.nio.channels.Channel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + java.nio.channels.FileChannel + + + All + private + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JAVA + java.nio.channels.ServerSocketChannel + + java.nio.channels.InterruptibleChannel + java.nio.channels.SelectableChannel + java.io.Closeable + java.nio.channels.NetworkChannel + java.nio.channels.spi.AbstractInterruptibleChannel + java.nio.channels.spi.AbstractSelectableChannel + java.lang.AutoCloseable + java.nio.channels.Channel + java.nio.channels.ServerSocketChannel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + java.nio.channels.SelectableChannel + + + All + private + + + + + + + + + + + + + + + + + + + + + - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - + + - - @@ -457,6 +948,66 @@ + + + + + + + + + + + Spring + + + + + + + + + + + + + + + 1.8 + + + + + + + + MyNetty + + + + + 1.8 @@ -469,6 +1020,18 @@ + + + Maven: aopalliance:aopalliance:1.0 + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 69b7556..c20407a 100644 --- a/pom.xml +++ b/pom.xml @@ -116,6 +116,22 @@ ${springboot} + + + + com.alibaba + fastjson + 1.2.62 + + + + + com.google.code.gson + gson + 2.8.5 + + + \ No newline at end of file diff --git a/src/main/java/com/zpf/three/NioReceiveServer.java b/src/main/java/com/zpf/three/NioReceiveServer.java new file mode 100644 index 0000000..f6dbfde --- /dev/null +++ b/src/main/java/com/zpf/three/NioReceiveServer.java @@ -0,0 +1,151 @@ +package com.zpf.three; + +import config.NioDemoConfig; +import util.IOUtil; +import util.Logger; +import util.Print; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.*; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class NioReceiveServer { + private Charset charset = Charset.forName("UTF-8"); + + /** + * 服务端保存的客户端对象,对应一个客户端文件 + */ + static class Client { + volatile String fileName; + volatile long fileLength; + volatile long startTime; + InetSocketAddress remoteAddress; + FileChannel outChannel; + } + + public static void main(String[] args) throws IOException { + NioReceiveServer nioReceiveServer = new NioReceiveServer(); + nioReceiveServer.startServer(); + } + + + private ByteBuffer buffer = ByteBuffer.allocate(NioDemoConfig.SERVER_BUFFER_SIZE); + + Map clientMap = new HashMap<>(); + + public void startServer() throws IOException { + //获取selector选择器 + Selector selector = Selector.open(); + + ServerSocketChannel serverChannel = ServerSocketChannel.open(); + serverChannel.configureBlocking(false); + + InetSocketAddress address = new InetSocketAddress(NioDemoConfig.SOCKET_SERVER_PORT); + serverChannel.bind(address); + + + //通道注册到选择器上,并注册io事件为 ‘接受新连接’ + serverChannel.register(selector, SelectionKey.OP_ACCEPT); + Print.tcfo("serverChannel is listening..."); + + //轮询感兴趣的io事件 + while (selector.select() > 0) { + //选择键集合 + Iterator it = selector.selectedKeys().iterator(); + while (it.hasNext()) { + //获取单个选择键,并处理 + SelectionKey key = it.next(); + if (key.isAcceptable()) { + //接受的事件是新连接事件,就获取客户端新连接 + ServerSocketChannel server = (ServerSocketChannel) key.channel(); + SocketChannel socketChannel = server.accept(); + if (socketChannel == null) { + continue; + } + //客户端新连接,切换为非阻塞模式 + socketChannel.configureBlocking(false); + //将客户端新连接通道注册到selector选择器上 + SelectionKey socketKey = socketChannel.register(selector, SelectionKey.OP_READ); + //业务 + Client client = new Client(); + client.remoteAddress = (InetSocketAddress) socketChannel.getRemoteAddress(); + clientMap.put(socketChannel, client); + Logger.debug(socketChannel.getRemoteAddress() + "连接成功..."); + } else if (key.isReadable()) { + processDate(key); + } + it.remove(); + } + } + } + + /** + * 处理客户端传输过来的数据 + * + * @param key + */ + private void processDate(SelectionKey key) { + Client client = clientMap.get(key.channel()); + SocketChannel socketChannel = (SocketChannel) key.channel(); + int num = 0; + try { + buffer.clear(); + while ((num = socketChannel.read(buffer)) > 0) { + buffer.flip(); + //客户端发过来的首先是文件名 + if (null == client.fileName) { + String fileName = charset.decode(buffer).toString(); + + String destPath = IOUtil.getResourcePath(NioDemoConfig.SOCKET_RECEIVE_PATH); + File directory = new File(destPath); + if (!directory.exists()) { + directory.mkdir(); + } + + client.fileName = fileName; + String fullName = directory.getAbsolutePath() + File.separatorChar + fileName; + Logger.debug("传输目标文件" + fullName); + + File file = new File(fullName); + FileChannel fileChannel = new FileOutputStream(file).getChannel(); + client.outChannel = fileChannel; + + } else if (0 == client.fileLength) { + //其次是文件长度 + long fileLength = buffer.getLong(); + client.fileLength = fileLength; + client.startTime = System.currentTimeMillis(); + Logger.debug("开始传输"); + } else { + //写入文件 + client.outChannel.write(buffer); + } + buffer.clear(); + + } + } catch (Exception e) { + key.cancel(); + e.printStackTrace(); + return; + } + //close 为 -1 + if (num == -1) { + IOUtil.closeQuietly(client.outChannel); + System.out.println("上传完成"); + key.cancel(); + Logger.debug("文件接收成功,File Name:" + client.fileName); + Logger.debug(" Size:" + IOUtil.getFormatFileSize(client.fileLength)); + long endTime = System.currentTimeMillis(); + Logger.debug("NIO IO 传输毫秒数:" + (endTime - client.startTime)); + } + } +} + + diff --git a/src/main/java/com/zpf/three/NioSendClient.java b/src/main/java/com/zpf/three/NioSendClient.java index 9387f89..50312ac 100644 --- a/src/main/java/com/zpf/three/NioSendClient.java +++ b/src/main/java/com/zpf/three/NioSendClient.java @@ -1,8 +1,16 @@ package com.zpf.three; -import config.ZConfig; -import org.apache.zookeeper.common.IOUtils; - +import config.NioDemoConfig; +import sun.rmi.runtime.Log; +import util.IOUtil; +import util.Logger; + +import java.io.File; +import java.io.FileInputStream; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.FileChannel; +import java.nio.channels.SocketChannel; import java.nio.charset.Charset; public class NioSendClient { @@ -13,12 +21,59 @@ public class NioSendClient { */ public void sendFile(){ try{ - - String sourcePath = ZConfig.SOCKET_SEND_FILE; - //String srcPath = IOUtils.g - - - + String sourcePath = NioDemoConfig.SOCKET_SEND_FILE; + String srcPath = IOUtil.getResourcePath(sourcePath); + Logger.debug("srcPath ="+srcPath); + + String destFile = NioDemoConfig.SOCKET_RECEIVE_FILE; + Logger.debug("destFile="+destFile); + + File file = new File(srcPath); + if (!file.exists()){ + Logger.debug("文件不存在"); + return; + } + + FileChannel fileChannel = new FileInputStream(file).getChannel(); + SocketChannel socketChannel = SocketChannel.open(); + socketChannel.socket().connect(new InetSocketAddress(NioDemoConfig.SOCKET_SERVER_IP,NioDemoConfig.SOCKET_SERVER_PORT)); + socketChannel.configureBlocking(false); + Logger.debug("client 成功连接服务器"); + + while (!socketChannel.finishConnect()){ + Logger.debug("自旋中"); + } + + + ByteBuffer fileNameByteBuffer = charset.encode(destFile); + socketChannel.write(fileNameByteBuffer); + + ByteBuffer buffer = ByteBuffer.allocate(NioDemoConfig.SEND_BUFFER_SIZE); + buffer.putLong(file.length()); + + buffer.flip(); + socketChannel.write(buffer); + buffer.clear(); + + + Logger.debug("开始传输文件"); + int length = 0; + long progerss = 0; + while ((length = fileChannel.read(buffer))>0){ + buffer.flip(); + socketChannel.write(buffer); + buffer.clear(); + progerss += length; + Logger.debug("| "+(100 * progerss / file.length())+""); + } + + if (length == -1){ + IOUtil.closeQuietly(fileChannel); + //该方法的源码 + socketChannel.shutdownOutput(); + IOUtil.closeQuietly(socketChannel); + } + Logger.debug("===============文件传输完成================="); }catch (Exception e){ @@ -26,7 +81,8 @@ public class NioSendClient { } public static void main(String[] args) { - System.out.println(ZConfig.FILE_DEST_PATH); + NioSendClient client = new NioSendClient(); + client.sendFile(); } diff --git a/src/main/java/config/NioDemoConfig.java b/src/main/java/config/NioDemoConfig.java new file mode 100644 index 0000000..3383d3a --- /dev/null +++ b/src/main/java/config/NioDemoConfig.java @@ -0,0 +1,56 @@ +package config; + + +import util.ConfigProperties; + +public class NioDemoConfig extends ConfigProperties +{ + + + static ConfigProperties singleton + = new NioDemoConfig("/system.properties"); + + private NioDemoConfig(String fileName) + { + super(fileName); + super.loadFromFile(); + } + + + public static final String FILE_SRC_PATH + = singleton.getValue("file.src.path"); + + public static final String FILE_DEST_PATH + = singleton.getValue("file.dest.path"); + + public static final String FILE_RESOURCE_SRC_PATH + = singleton.getValue("file.resource.src.path"); + + public static final String FILE_RESOURCE_DEST_PATH + = singleton.getValue("file.resource.dest.path"); + + + //发送文件路径 + + public static final String SOCKET_SEND_FILE + = singleton.getValue("socket.send.file"); + public static final String SOCKET_RECEIVE_FILE + = singleton.getValue("socket.receive.file"); + public static final String SOCKET_RECEIVE_PATH + = singleton.getValue("socket.receive.path"); + + + public static final int SEND_BUFFER_SIZE + = singleton.getIntValue("send.buffer.size"); + + public static final int SERVER_BUFFER_SIZE + = singleton.getIntValue("server.buffer.size"); + + public static final String SOCKET_SERVER_IP + = singleton.getValue("socket.server.ip"); + + public static final int SOCKET_SERVER_PORT + = singleton.getIntValue("socket.server.port"); + + +} diff --git a/src/main/java/util/ClassLoaderUtil.java b/src/main/java/util/ClassLoaderUtil.java new file mode 100644 index 0000000..5e7a1e2 --- /dev/null +++ b/src/main/java/util/ClassLoaderUtil.java @@ -0,0 +1,30 @@ +package util; + +public class ClassLoaderUtil +{ + + /** + * 显示classLoaderTree + *

+ * 当前加载器和所有的父 加载器 + * + * @param aClass + */ + public static void showLoader4Class(Class aClass) + { + ClassLoader loader = aClass.getClassLoader(); + showLoaderTree(loader); + } + + /** + * 迭代,显示class loader 和 父加载器 + */ + public static void showLoaderTree(ClassLoader loader) + { + while (loader != null) + { + Logger.debug(loader.toString()); + loader = loader.getParent(); + } + } +} diff --git a/src/main/java/util/ConfigProperties.java b/src/main/java/util/ConfigProperties.java new file mode 100644 index 0000000..03a8a01 --- /dev/null +++ b/src/main/java/util/ConfigProperties.java @@ -0,0 +1,114 @@ +package util; + + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Field; +import java.util.Properties; + + +/** + * @author + */ +public class ConfigProperties +{ + + private String properiesName = ""; + private Properties properties = new Properties(); + + + public ConfigProperties() + { + + } + + public ConfigProperties(String fileName) + { + this.properiesName = fileName; + } + + + protected void loadFromFile() + { + InputStream in = null; + InputStreamReader ireader = null; + try + { + String filePath = IOUtil.getResourcePath(properiesName); + in = new FileInputStream(filePath); + //解决读非UTF-8编码的配置文件时,出现的中文乱码问题 + ireader = new InputStreamReader(in, "utf-8"); + properties.load(ireader); + } catch (IOException e) + { + e.printStackTrace(); + } finally + { + IOUtil.closeQuietly(ireader); + } + } + + + /** + * 按key获取值 + * + * @param key + * @return + */ + public String readProperty(String key) + { + String value = ""; + + value = properties.getProperty(key); + + return value; + } + + + public String getValue(String key) + { + + return readProperty(key); + + } + + public int getIntValue(String key) + { + + return Integer.parseInt((readProperty(key))); + + } + + public static ConfigProperties loadFromFile(Class aClass) + throws IllegalAccessException + { + + ConfigProperties propertiesUtil = null; + + + return propertiesUtil; + } + + public static void loadAnnotations(Class aClass) + { + + ConfigProperties configProperties = null; + try + { + configProperties = loadFromFile(aClass); + + + if (null == configProperties) return; + + Field[] fields = aClass.getDeclaredFields(); + + } catch (IllegalAccessException e) + { + e.printStackTrace(); + } + } + + +} \ No newline at end of file diff --git a/src/main/java/util/Dateutil.java b/src/main/java/util/Dateutil.java new file mode 100644 index 0000000..d66d9d2 --- /dev/null +++ b/src/main/java/util/Dateutil.java @@ -0,0 +1,45 @@ +package util; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +public class Dateutil +{ + + /** + * 取得今天的日期 + * + * @return + */ + public static String getToday() + { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + return sdf.format(new Date().getTime()); + } + + /** + * 取得昨天的日期 + * + * @return + */ + public static String getYestoday() + { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DAY_OF_YEAR, 1); + Date date = calendar.getTime(); + return sdf.format(date.getTime()); + } + + public static String getNow() + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + + return sdf.format(new Date().getTime()); + + } +} diff --git a/src/main/java/util/DeEnCode.java b/src/main/java/util/DeEnCode.java new file mode 100644 index 0000000..f918d60 --- /dev/null +++ b/src/main/java/util/DeEnCode.java @@ -0,0 +1,48 @@ +package util; + +import java.nio.charset.Charset; + +public class DeEnCode +{ + + private static final String key0 = "FECOI()*&"+path); String decodePath = null; - try{ - decodePath = URLDecoder.decode(path,"UTF-8"); - }catch (Exception e){ - - } + try + { + decodePath = URLDecoder.decode(path, "UTF-8"); + } catch (UnsupportedEncodingException e) + { + e.printStackTrace(); + } return decodePath; } - public static void main(String[] args) { - System.out.println(getResourcePath("/util.IOUtil")); + /** + * 构建当前类路径下的 resName资源的完整路径 + * url.getPath()获取到的路径被utf-8编码了 + * 需要用URLDecoder.decode(path, "UTF-8")解码 + * + * @param resName 需要获取完整路径的资源,需要以/打头 + * @return 完整路径 + */ + public static String builderResourcePath(String resName) + { + URL url = IOUtil.class.getResource("/"); + String path = url.getPath(); + String decodePath = null; + try + { + decodePath = URLDecoder.decode(path, "UTF-8"); + } catch (UnsupportedEncodingException e) + { + e.printStackTrace(); + } + return decodePath + resName; } + public static void closeQuietly(java.io.Closeable o) + { + if (null == o) return; + try + { + o.close(); + } catch (IOException e) + { + e.printStackTrace(); + } + } + /** + * 格式化文件大小 + * + * @param length + * @return + */ + public static String getFormatFileSize(long length) + { + double size = ((double) length) / (1 << 30); + if (size >= 1) + { + return fileSizeFormater.format(size) + "GB"; + } + size = ((double) length) / (1 << 20); + if (size >= 1) + { + return fileSizeFormater.format(size) + "MB"; + } + size = ((double) length) / (1 << 10); + if (size >= 1) + { + return fileSizeFormater.format(size) + "KB"; + } + return length + "B"; + } + private static DecimalFormat fileSizeFormater = FormatUtil.decimalFormat(1); - - + /** + * ByteBuffer中字符串是以ascii中0(null)字符结束 + * 如果是以别的字符结束,则修改if(btemp[i]==0){ + * break; + * }即可 + * + * @param buf + * @param MaxLen + * @return + */ + public static String getVarStrFromBuf(ByteBuffer buf, int MaxLen) + { + byte[] btemp = new byte[MaxLen]; + byte j = -1; + int avaibleBytes = buf.array().length - buf.position(); + if (!(avaibleBytes > 0)) + { + return ""; + } + int len = 0; + for (int i = 0; i < MaxLen; i++) + { + btemp[i] = buf.get(); + len = i; + if (btemp[i] == 0) + { + break; + } + } + try + { + return new String(btemp, 0, len, "UTF-8"); + } catch (UnsupportedEncodingException e) + { + e.printStackTrace(); + } + return null; + } } diff --git a/src/main/java/util/JsonUtil.java b/src/main/java/util/JsonUtil.java new file mode 100644 index 0000000..e7aa088 --- /dev/null +++ b/src/main/java/util/JsonUtil.java @@ -0,0 +1,65 @@ +package util; + +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.io.UnsupportedEncodingException; + +public class JsonUtil { + + //谷歌 Gson + static Gson gson = null; + + static { + //不需要html escape + gson=new GsonBuilder() + .disableHtmlEscaping() +// .excludeFieldsWithoutExposeAnnotation() + .create(); + + } + + //Object对象转成JSON字符串后,进一步转成字节数组 + public static byte[] Object2JsonBytes(Object obj) { + + //把对象转换成JSON + + String json = pojoToJson(obj); + try { + return json.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return null; + } + + //反向:字节数组,转成JSON字符串,转成Object对象 + public static T JsonBytes2Object(byte[] bytes, Class tClass) { + //字节数组,转成JSON字符串 + try { + String json = new String(bytes, "UTF-8"); + T t = jsonToPojo(json, tClass); + return t; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + //使用谷歌 Gson 将 POJO 转成字符串 + public static String pojoToJson(Object obj) { + //String json = new Gson().toJson(obj); + String json = gson.toJson(obj); + + return json; + } + + //使用阿里 Fastjson 将字符串转成 POJO对象 + public static T jsonToPojo(String json, Class tClass) { + T t = JSONObject.parseObject(json, tClass); + return t; + } + + +} diff --git a/src/main/java/util/JvmUtil.java b/src/main/java/util/JvmUtil.java new file mode 100644 index 0000000..1afd731 --- /dev/null +++ b/src/main/java/util/JvmUtil.java @@ -0,0 +1,21 @@ +package util; + +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; + + +public class JvmUtil +{ + + public static final int getProcessID() + { + // ManagementFactory是一个在运行时管理和监控Java VM的工厂类 + // 它能提供很多管理VM的静态接口的运行时实例,比如RuntimeMXBean + // RuntimeMXBean是Java虚拟机的运行时管理接口. + // 取得VM运行管理实例,到管理接口句柄 + RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); + // 取得VM运行管理实例的名称,也是JVM运行实例的名称 + String jvmInstanceName = runtimeMXBean.getName(); + return Integer.valueOf(jvmInstanceName.split("@")[0]).intValue(); + } +} diff --git a/src/main/java/util/Logger.java b/src/main/java/util/Logger.java new file mode 100644 index 0000000..4f45a9a --- /dev/null +++ b/src/main/java/util/Logger.java @@ -0,0 +1,108 @@ +/** + * Created by nien woo + * Date: 17-12-30 + * Time: 下午4:50 + */ +package util; + + +public class Logger +{ + + /** + * 带着方法名输出,方法名称放在前面 + * + * @param s 待输出的字符串形参 + */ + public static void debug(Object s) + { + String content = null; + if (null != s) + { + content = s.toString().trim(); + } + else + { + content = ""; + } + + String out = String.format("%20s |> %s ", ReflectionUtil.getCallMethod(), content); + System.out.println(out); + } + + + /** + * 带着线程名+类名+方法名称输出 + * + * @param s 待输出的字符串形参 + */ + synchronized public static void info(Object s) + { + String content = null; + if (null != s) + { + content = s.toString().trim(); + } + else + { + content = ""; + } + String cft = "[" + Thread.currentThread().getName() + "|" + ReflectionUtil.getNakeCallClassMethod() + "]"; + + String out = String.format("%20s |> %s ", cft, content); + System.out.println(out); + + } + + /** + * 带着线程名+类名+方法名称输出 + * + * @param args 待输出的字符串形参 + */ + synchronized public static void info(Object... args) + { + StringBuilder content = new StringBuilder(); + ; + for (int i = 0; i < args.length; i++) { + content.append(args[i]!=null?args[i].toString():"null"); + content.append(" "); + } + + String cft = "[" + Thread.currentThread().getName() + "|" + ReflectionUtil.getNakeCallClassMethod() + "]"; + + String out = String.format("%20s |> %s ", cft, content.toString()); + System.out.println(out); + + } + + /** + * 带着线程名+类名+方法名称输出 + * + * @param args 待输出的字符串形参 + */ + synchronized public static void error(Object... args) + { + StringBuilder content = new StringBuilder(); + ; + for (int i = 0; i < args.length; i++) { + content.append(args[i]!=null?args[i].toString():"null"); + content.append(" "); + } + + String cft = "[" + Thread.currentThread().getName() + "|" + ReflectionUtil.getNakeCallClassMethod() + "]"; + + String out = String.format("%20s |> %s ", cft, content.toString()); + System.err.println(out); + + } + + /** + * 编程过程中的提示说明 + * + * @param s 提示的字符串形参 + */ + public static void hint(Object s) + { + System.out.println("/--" + s + "--/"); + } +} diff --git a/src/main/java/util/Print.java b/src/main/java/util/Print.java new file mode 100644 index 0000000..3770e0e --- /dev/null +++ b/src/main/java/util/Print.java @@ -0,0 +1,55 @@ +/** + * Created by 尼恩 at 疯狂创客圈 + */ + +package util; + + +public class Print { + + /** + * 信息输出 + * + * @param s 输出的字符串形参 + */ + public static void o(Object s) { + System.out.println(s); + } + + /** + * 带着方法名输出,方法名称放在前面 + * + * @param s 待输出的字符串形参 + */ + public static void fo(Object s) { + System.out.println(ReflectionUtil.getCallMethod() + ":" + s); + } + + /** + * 带着类名+方法名输出 + * + * @param s 待输出的字符串形参 + */ + synchronized public static void cfo(Object s) { + System.out.println(ReflectionUtil.getCallClassMethod() + ":" + s); + } + + /** + * 带着线程名+类名+方法名称输出 + * + * @param s 待输出的字符串形参 + */ + synchronized public static void tcfo(Object s) { + String cft= "["+Thread.currentThread().getName()+"|"+ReflectionUtil.getNakeCallClassMethod()+"]"; + System.out.println(cft + ":"+ s); + } + + /** + * 编程过程中的提示说明 + * + * @param s 提示的字符串形参 + */ + public static void hint(Object s) { + System.out.println("/--" + s + "--/"); + } +} diff --git a/src/main/java/util/RandomUtil.java b/src/main/java/util/RandomUtil.java new file mode 100644 index 0000000..8e227a1 --- /dev/null +++ b/src/main/java/util/RandomUtil.java @@ -0,0 +1,35 @@ +package util; + +import java.util.Random; + +public class RandomUtil +{ + private static Random random = new Random(); + + /** + * 按照范围,生成随机的整数 + * + * @param mod + * @return [1, mod]之间的整数 + */ + public static int randInMod(int mod) + { + return Math.abs(random.nextInt(mod)) + 1; + } + + /** + * 按照上下限范围,生成随机的整数 + * + * @param low 下限 + * @param high 上限 + * @return + */ + public static int randInRange(int low, int high) + { + + return randInMod(high - low) + low; + + } + + +} diff --git a/src/main/java/util/ReflectionUtil.java b/src/main/java/util/ReflectionUtil.java new file mode 100644 index 0000000..48adbb0 --- /dev/null +++ b/src/main/java/util/ReflectionUtil.java @@ -0,0 +1,104 @@ +package util; + + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Created by nien woo + * Date: 18-1-11 + * Time: 下午12:40 + */ +public class ReflectionUtil +{ + /** + * 获得调用方法的名称 + * + * @return 方法名称 + */ + public static String getCallMethod() + { + StackTraceElement[] stack = Thread.currentThread().getStackTrace(); + // 获得调用方法名 + String method = stack[3].getMethodName(); + return method; + } + + /** + * 获得调用方法的类名+方法名,带上中括号 + * + * @return 方法名称 + */ + public static String getCallClassMethod() + { + StackTraceElement stack[] = Thread.currentThread().getStackTrace(); + // 获得调用方法名 + String[] className = stack[3].getClassName().split("\\."); + String fullName = className[className.length - 1] + ":" + stack[3].getMethodName(); + return fullName; + } + + /** + * 获得调用方法的类名+方法名 + * + * @return 方法名称 + */ + public static String getNakeCallClassMethod() + { + StackTraceElement stack[] = Thread.currentThread().getStackTrace(); + // 获得调用方法名 + String[] className = stack[3].getClassName().split("\\."); + String fullName = className[className.length - 1] + "." + stack[3].getMethodName(); + return fullName; + } + + /** + * 取得父类所有的接口 + * + * @param targetClass + * @return + */ + public static Class[] getInterfaces(Class targetClass) + { + Set> interfaceSet = new HashSet<>(); + //数组转成list + List> subList = Arrays.asList(targetClass.getInterfaces()); + if (subList.size() > 0) + interfaceSet.addAll(subList); + Class superClass = targetClass.getSuperclass(); + while (null != superClass) + { + subList = Arrays.asList(superClass.getInterfaces()); + + if (subList.size() > 0) + interfaceSet.addAll(subList); + + superClass = superClass.getSuperclass(); + } + //set 转成 数组 + return interfaceSet.toArray(new Class[0]); + + } + + public static Object newProxyInstance(Object targetObject, InvocationHandler handler) + { + + + Class targetClass = targetObject.getClass(); + + ClassLoader loader = targetClass.getClassLoader(); + + //被代理类实现的接口 + Class[] targetInterfaces = ReflectionUtil.getInterfaces(targetClass); + + Object proxy = Proxy.newProxyInstance(loader, targetInterfaces, handler); + return proxy; + } + +} + + diff --git a/target/classes/com/zpf/three/NioReceiveServer$Client.class b/target/classes/com/zpf/three/NioReceiveServer$Client.class new file mode 100644 index 0000000000000000000000000000000000000000..dcc410f0deab36ba578f3cad663f823f02f85ab0 GIT binary patch literal 586 zcma)3%SuBr5Iw22FRQJO`hG1G9}BZ_r-)Jzlv2Tp`}B6&n|hl_ZrX)^nQK->xxW3QZl&`HOvqk;8w)#*5jV}Z@_1VdilFtlv&M1E3DX4#>yhsqd= z1a>A`ZDlad#qyeWO$02@ool20g}~I|(W5}NZaciQ($I#Q!$F(egK9^qZyTuSQ8}I5 zC&{c2H9N}HBTdE&ly7*gt4Au1iSq}Izz*cgb65J%5y_^u_Y{yGQH$J&+}^k^G2OC5 z7f@nNp!QpLk~~=%vzW_cQ(*sJQw6F&FMZeUQ@{qd|8B)DGW>7AG%k^41al7glnW^X zMU?ms%%IFD_^>hN3P+MT$xI)=LA-L1L6tF=Cf6{}ad|Aj0%~b}ImHz$F_*ZO!5S7( F_y!A|kBI;P literal 0 HcmV?d00001 diff --git a/target/classes/com/zpf/three/NioReceiveServer.class b/target/classes/com/zpf/three/NioReceiveServer.class new file mode 100644 index 0000000000000000000000000000000000000000..7d7fd8ee2a30579bd661e7dd5abb57bc0bbb6ce9 GIT binary patch literal 6153 zcma)A3w%`NmH(e)CU@rM#*pxku{?rA3=oJ_1ezd9LQ*0jiAf*@YU$17CR~}!#F;x( z-0iM?Sga4K);_SU(wFH|3zZ>=wY0l^Zr6Ra`>@-$plx@z-A8wI+lBp~duNgv3AR7N zcklfk=ls8O{^xw>n{S_c>KOoQBw=DV9*bbY#HaA-C@S%pC_anNnfN>&*Uu*me8EHn zkLkxz1IJ80AJgWGCZ5D`6LrXGbHc!+E|($-s9^)T_!h_{%8Yo~^`R;jaz+jfv&j zy&QiV!QbigyV`uu#NXo|RMkb9}_R(Wdr}Kn0{-b2ftGt{}<()a}k_31tJkCi%2>9B@~e`RY-*)hM=M?;W|lA zV09*wPP#2&XEIJkV8r*@>5RjH%ero{_uEZLH`SEyYibL|TDW{DJ2K*=1#_oowI1-C zR==AQqH$mTHhWx99n8skZlZ}DI@<4!CT%a9b_6$3SOl4ZC5I8CwACrSHJU}A#blstJM7-eN+<~v)!a%Uc>HS0|`4h z+SKo*-Q;MCuh&kGQqt@hh6S@|<&q5u%=X*j&ba5Mk{N?uL}kXa(_XMWZYtyNQ*h;s z=29EGYhm?WNKb8p-(HPmyd3E(*b)Srr&1zh!dS9v)6R8Ct!t(D9l&la3dd zW>YXq74u46e_*`e{=@^EGWQx%$z;gvMXL9wvgx>^8YtwIvAkM0YGDMUg7Ef%j#cXou`H>QODwzzdkm?z zWELJZq{fn3nQh_Cumv@~d3-Kyu`_$=2@6Ar3l_aPGc9-+rN1nhBXhNxXUU~9pXo4Q z|4aZpL$x%owXzuQp_{C3UjI zlFMbOCG~QJAUPLyP)n|s zYb;rVcN%i7C2M7!;8I^r5%XHJZerL;Te4nW$ISZTmmfKM=#yvfy8q1Gk8&g0-E2vV zY%t_HOE&73t|w+3!h0;a0i%{|l2*au8PFG}BTL$3vnB1)Vae(Bo&196bB} zgU_GJ3Fa3|=*fEHS&zBgvBy-}4oe2*4VLW02Q3`N!C2zvRgmC8R zJI+kp6Ua7Xk0o!G4yONU+f7A?CAJ!2NSn9}TMVTU3V43s<8Sa)Yn9sdF-XP@}&3lk5Xecu=S3F~Da z51(mFJwvxJX%t}6fSo;4FsDM`LRxEXuJxsqB<~W@!BJSS>GPzQ#SzIC^5P>YCjMfd2SoG>Czd)|{rUA!#5^j3 za5J0YTAl@^qZZAY=2`d@=I04socv4OR$==B^yr__3B{?8_-2hdULTq5Ir*}M;W)MM z0=Loz>C(wXHt}ona%MEa`Wb8?)aa?vDo+9+IdLOc;@f%$o9r75LlIoTQ-Nw~ZLRSY|E|Ju=bk*U+Ut&MlA zDFwlCp>n6Y2__%$eeG@Sojcn1^llp1Qm{g2&vst3cnbS`$@qm;P!X2w`J#5GgGvIi zFpXDb1q1@v$^5I^X&aFoUrIt%+yTXvVPOPV=FFFbZKu5n*IuDQ%F`Ulc>oI_STk;*tX zWnIThum+zuz0EcqP+IzXEhqG;(wRo^lOnCoT7w%42vFM1WaVp1@F1$;UOQ6hG22so zdho0NZoJUol(k@{{z6=034hbr&7W?{QKn@z-^#R-<`Y^tLon?3ISBEc)i~R|?Agf` z!spTzCm<_o%O+8N9HAA*5S~QEaTqI3A+qxXqQ_w#^#!yYFgkWL;+mR-;hYbI-*bfwx)l!1Vk)KZTzBGyIZH?tQ%o;p}nw`f`djhk&8&~BpXRvYQ ztXVnC8?3!_67vZn_6UyhaoI_{M$jCJg-(JufWtVfZwm#dF}FD!3+J%tFvj$`_%!O8 zD`FKnENM1k#y3zgasE3ogW4`1j2SCKIV^3CoI*W!c|~(H7L6G>EIW;woU_6o&tYY4V-7^PdJ;_&s8LN<9Y%CTEPMj5RV-HvCeFtv&UdTTLQprP zv4HI=el^iPSK$&|jTo-MVyvT6)}s+E{JIVs`ELtuzyLPkjcB9yH`6ukT;G8#UGvA- ziaW856@528#NVMljb8o^cN3mPAHK^~-^X_R5IgV_4EmlKp`}M~GuQ4%1tsmkTW}i; z%GihlxSd!I;adC=I@;k9C96 z_$1aph6nkbpZU5Rnw!JN&@zb)%@wC`-OgCW32an`Fn~gE^IJQh+ZIrM&A9@%| z0-QIl3pdWAzRt!;Y(0*y+HF3!syS;*Fr#}gcwRd=aen>;s++?!L9ZgY>FC^0*%2gk z?j-t-p}%$@hwVCCfVYFl)DA@e1KfkbK<6ahFf~R5>%xVVJJ~%i%(Y!k4!Z)*AEkE| zNVU|Gf8{>AKSoc3nXHC+EXGW>fLW}bS?p>!XlC5E(wlwc<1TW^VP+WPzYKH50p^Jh z()Uj=J3K{>ev_Baq$zyoqC9+dm=kRJ_)7J1z*2>u+p4Sdx9``Amkd0C~|YT)CQzx9*zCurj` Qe3H=&Y8P6#k~t#s|0(>bNB{r; literal 0 HcmV?d00001 diff --git a/target/classes/com/zpf/three/NioSendClient.class b/target/classes/com/zpf/three/NioSendClient.class index 2ef1fd71abe84d41a874302d30ef49fce21c8424..06b51f2b4be72298cccf973e86bd7befc7fc3b81 100644 GIT binary patch literal 3455 zcma)8Yj_-08GcW)*_oY8Z<{7$d$E^DNqP&Vm}1(X%{GBew@I2SDQev8PLgRiyX)>O zZ4sqjN};8QA{1(E3yMJ$Y9ef6Qwv@}R8Uc#hrimy{_vmv(nsTaW_Gg)Nqx+-Idd-G z{r$f0oVWgS`6__h@t%eq=u;8a5P{+0PQM2O7}Q|mpn^jh6nPw#-yu1~G{ljRG@ntC zRFKlJ1eP4qD(+KoSVIYp$l<7l`|(*hJfPrnlH>Docu+$*j%oM;z9`SWq~go+dtAjs z(uNaq@vtO(M8ip(l9C^lv(s{TOb%aB@wkSs;%h3ND54kgFCuOGx{4>I;ZI2!XH-0` z;28yHHG0)2hi@o2C!mA}L&=n339JYn4BZ#1j+yc5>|V9sIom1V-ety2>rR2f%Bn5_ zmp>jc1eOHNn9-ab>NAoZp}r`0yuo-l6zvKnO}Wl)x~xGnC9paejt^DepXjf)29t(S z-E79&jabAVHI0}>9cqfJMpKH>Qt@;$Y_x`~K`GNVEEP?x+zPkWPvK1CU6@2aIHju@X(RqTLFG5A6#j z>@X5K1>a`n@s{DD zCv$+=Dub`17Bsu4v!ij#9SWY+@f^OT;|_dO!MAlh55I!%=orQe0yljSt@^YXjmT(t zvY4%{)A3!rsN;M1zJix@yo^gaegHp7a$wd8=(eCNiqe7+9i#Xm({Adi6W1m(*Tzpz zzV!6uxfz{V(m*VcwwNeJXh?FsqT^L$7&0AW7}xP5TxPP{vSWr-9pK<#xjPa`8mW|y z3HWtfL968cv4X2QUc>7;euAG0ta3uOcIx5BCr@6u{@VGe$DW@$cY5;Vvy;!fpyOxK zKF{?NFHW5~b#0uk{T#p0@k_j+<4v>@G#$UfTRK|sYaPGAZ*{zlcXa#??=bF@SB^~% zpSpJC;`OUfI4%-v9lysL0tFAOl|lQ10Cc>IKkE1s#szMxoBNlIj4fjFewyuUz%rZ={snI*)?WuIkm|;cVg@Gk$L6C`kQ|~r^E`Phe~10(FqD!m!iPa-8&Oc{m>HHwR=l+G7mG{q~A} zwYT{9Hgxp1H#G0*Z43k(*hSKo8LbYqbn?R_95AdlV|Jg~aAVc8tCD3GN+j6o1h)KN z9NGGzt*RBz1$lX8)qF>DHU{GZ>?5q#h|!lGU>lmP$3bqVYz`$^C)*nQ4S}wPteTH1;gOcx>ITIz24E(%QphvDaBOy?+AnBZ}AhA1T z_gvaNL(U{{sCb-*tgWk|tvArhlA1x$-fC@W>yW*2e&hnu!6i8$v zGWMrU!-^iw<3@pgc_3qGM}Ki@Fl|NRhhr^iizZ?nUpG7W3}V-mR}^Q3obv|bxQnY@ z+-D!f;*Dbv8@&bND0~&J5$+VAj-$peuoNyV!=0Sz4mCc8k8>qtFLWdo`~^ikh1ffa zqTr@+xc5y!=^2CS^<O0igA3nR`sb;+szql==P}@+|o?~e%ITp%5HBJ1r*kJ zJUcXBkv!PgQ{y?0yBDG@(@H(ZLp!vbdzA!(UEVeDGie)?gJXu$lm`fgfwJ zm%z7TJ@(^f^kM^_&$r+xd5)n9$FT{gu^CU|R$Ra~zErm364T@|YVbOfHR!D1twui9Wb#-!OvM$0z(HoIx{Z zDs4*e&Cp7}-^UR3v@uDUcG;9{r`CI*PV=BhL5G6Q+^-AxH?}M2R&dXfX(})Nz`1jz zpoc%<0{(^lrPEX`NGFE_pw4^o2`AxcX@QN;q6ys2JpV|LaM$E3XEB`v8C7($F1qY+ ZlsOFeBtFG6m9F+OsC?q$(_9xI^j~*pl@0&^ delta 548 zcmZvYOD{t~7>3_DJvE)vX&%Ez9^WE~sXI{UaUjR&C)_@;TA7TdLXcsWhA<&5~ zj&6Y-^twf#fqo2d3~~(JeBRau(vF=uUbjyzdq1BgQax+)O7nEYgQ#ZkZduF2NseKO z5ttGZ0gh3LF(lN7-WcW>my|pyF@*%jv_uj!3=x%Mkq|@8k$q{KdAo3EZtNdrGmg6V zZi`^1SUAWXnmbBXMbsT@*sI{uSLaUlguzq1a2Og=WrtkR+&s$_oV0V6wNK_4g3D{E zrQOA)w6(jrV68HQ{^1z-se3D5Pyrr}qMd%kPd~+=xep=bAx-b3wMM;**mW)S3_1mT z&>>JqO42Ea3Zb5M8tIoOZBga2q6Ba10eb4OjOyU1B5T*Ij%+|mM>BPs$hM`zRQ#DX y62qabSS~`bVWMdy>Lw|`jWf<0LlsJ0T?0?!B}LP;kbL!8pd_m}{{n_DPs_?6GFXk;+S- z+W%=I5vi5(RVJsiCjKXxu>zHz{y=lUlyXli8RSKG}Uw1=~&wb%o{KAVA(xs-fIal_A zRnrdkn@(NSTb^&qZkzn|O4IM(J-Wa*C7hraHcf#nDEfeBmIq=XhtDlM#&w0+Ve!c; z7yTB+rk(A6n6HI%I8QU?i?dPK%y!-Qg@q@0YT*Jd(qKi?GEv-DU1Dikq@jrV7m1v)S9)GGR9I zUQ)DY_}RiDmZ;*$ggYc3P+w!s$0WqS>st7X!=*kXC-QC(#ul>dF*o!BQLy~LZ56_x zU69e}Z4=jBzeiJ=AGS1~?vcV_@+o%SyA9p7BF@uydzStj7Bmly*l`|_APq&3+Am0b z7NoukQWFKKV}jHiL288{l`cqy5{}SA%LIil=v0t1kXT&WgIe6f$X{afCB3I8CtwtOdKZ&S z6G9I&wS*pFIwf?PX;SD>rYWH_OlO78F-^ZhW*5hp9v6Co=}9p-#q_jD&u~2oT+b$s zNyZjtshT-t=s88Q3phbLdXiS;G})b@IxgY{E+LQ0Si?NZq;;@BU*8g*;~HADG9L9X Ypbp05@shgnJN4raLWS??juHIu4!OuvaR2}S literal 0 HcmV?d00001 diff --git a/target/classes/util/ClassLoaderUtil.class b/target/classes/util/ClassLoaderUtil.class new file mode 100644 index 0000000000000000000000000000000000000000..21252113977dc8bcc5a37cab81a8a2a54b6c1697 GIT binary patch literal 868 zcmZ`%%Wl&^6g^`naqPNj8=MqU3Y4dlLc^lFA~uz}!91jd?kCB}bulq=9QY*GY)Zv~ zB@4cWF96QimJ+2POLOPG&N=svfBydV9l#-;I;dmE!AS?+{9w&*Q0Ya&bZ@6sGPkKs%(i|;D+D*@5J>i8DwcR z4fRf!%Zey>vX)B;k}y=MKy{)|erMAT&q> zc2rq!vqK}bi)u7+jb4?XhZZqx{U{~okX8%wdOy%4Zsn5NE>L^%`OhznZsz)$sPKNB aXNO95h_}0>)yr{p9;`6P$M@jfK<6(`Ho2n! literal 0 HcmV?d00001 diff --git a/target/classes/util/ConfigProperties.class b/target/classes/util/ConfigProperties.class new file mode 100644 index 0000000000000000000000000000000000000000..3d895fbf206193e73636fdc3e855214e56d5719d GIT binary patch literal 2441 zcmZ`)ZBr9h6n<_Jv&pg{8cdXeN^P|eK(tb8iP9p9riK>*QEFSeBuiLXvgu}H+ketu zP`~s;nNeWsO#8jRsnhnkcb9BbIt+VX&N!08M05AzpM?dbRP)_4CzSMAE zM*{ccp`v3R3mO)6q_CvnK?=({bgW2?RVjR^VNFLCkL1l`oi^(_zQPl^`&!30_*TPH z9R)nn@SO%zAk*~RrsdgIYr)*H1ag&U=5uqxF&p)X72mTP^^$-dDEZV9CEO)`0&V@Kw{Rd5inb^8`eU5XT$PV%?(FA;Z{v&&Gc+}4lfh_mQC*qLdlZpZwUw<^MSqXPLvn#{8+V` zzU?;XcFbZS zL!yM?{3LMks94?&kD1)IsDA9Z>9l1)b<1B1wmsaI8;7SOb5j;5cE2<0n5|Z6`d&I!Q4dl;Y(ipg*B)W9IlXs8*maE*LZ zI^=}JEk}iwP!|OH55--gpysSf+ut0&E)_Qo)Ujp2#xsGwj!DEa1KT)fz`->GpWvE? z9Rm%N419ze8e9WSd@nGhELGy`uAfm8hEIJ5hZC;EBb7=blDz=u3ZR=cA8M=K|Jy8f?!Y2rbi~Q$^CIQ1RM3yIsa7R?ceDNjX2hbK? zBeg!hk96fV^!3qP&pr$(OOEX!Gj@R97dX8zzK7$%-k3_rO@HFgU4kVrj0yf0$+bk_ z3I4XpwS=2$jjOCoQv-A?#^|Lx2DS4jGP9%HUBMVWrsWte;}Y$!;5yGGt}|S3INaDO9@dKjU3X|-D7^AbRi{J)M@on44<=pwvpAj`cwykBKy1zPJ+&?nwzK;Jk>WJ$D&4hEiZA07VaP=Fr~Y_wIxbFqi3;FS#%tRFAF3z zygvX7ukhNy8w+po&cX^-Ev(@^4e%P*>)66NHaOvfz}Pi$=J%wUv0ZGIvU>7aoL+FM-!CUKWeL%4_g6yf9&!ul?KiO@kRe2&QH+$Ew1 z=ZJM+Tp-@T(09UhIr+~46*j3tkJqI06dq{abe~rdZ3{R@L~=fwa3 literal 0 HcmV?d00001 diff --git a/target/classes/util/DeEnCode.class b/target/classes/util/DeEnCode.class new file mode 100644 index 0000000000000000000000000000000000000000..b795237727e0d5c74c370aac6c9b9832ada334f5 GIT binary patch literal 1527 zcmcIj!EPH>6g_V|o*7RkO={}4apU6BP;AGE12HDVX`pcv2z8R8gb2uL>oEbD8 zBZVdEjui`jpc|HmRo5qAll*U1%Xf>H}J@?#m?>u<)!x4Zg z-ZwFV*Haim&A=Nbbj+GG-jvInj=J>Bo4A4n18P-ws_edf}LB=8{Esnb4STcLrsf z8$mB@JIkIda_C73Q&MmX=P+vFjHGe)An4`o(8-6MyBp<$z5K7=fBD=rt7Fx|8rChGMuvHx(T`#;FE!Rz3dPdp`PH?? zhaca#-js=MJOjVpy6LppZo_q=K}Xd>QT8-R(WMwCV%TQjx=u*%j??P70-3^7()B^= z^7Xlx`7u+&+4>|1*X(^NH1%}wU>1x2HE$ON0mtChNfsA5_appf63F5d(qQjsDL6@+ z+VE`34scKMjt$|OrB&fBq_=b*;yWG`oad_bofzZU8k}>uKr1DiM2`&q2`UWk^~9C) z3uC$4sNR7xr;e&ewPd2EWwcE4HnO8?Mw_YWrLof3Oh*6WtIb=Q_~!91w-l~F%an;Y zWtK_78d79GPR>)@tF-6HTGFVJ`8cb%h?n?bE11P4+6pPu@G?&cNd%YU8s+H~`UDE} zW}rTVD#Rn4(oq!RcjW#cSV~UX|5r&amTH`Qrzlw!IaV_M9FRJI7I62UiXDBFsjIImN+sKl)p^UlQG?VACF~Jh?`&` z)A4{A9HUoBQeo6dWf literal 0 HcmV?d00001 diff --git a/target/classes/util/FileLogger.class b/target/classes/util/FileLogger.class new file mode 100644 index 0000000000000000000000000000000000000000..919826dbd030c1ffb3e1abcd911c639990aeba75 GIT binary patch literal 1928 zcma)7TUQ!a6#fQA25}UFmuO7dG;LDvw5cYonnXoyR1^&;Vy^=XIEoAzhG_pv|3IE? z*Fslat9|c}>3bh~`OXKm80~3a25wg9QzX?YM_n2tF)n zSPr2LD}_)5dq3bc}4T(L@~g0A?X@y3W+c2wB23IcOh*>ayN@DGpdDo|r~ zo^Ii|RW>(k$63=!8Cek+iQ74&v}-t)up67Idtg-++=|y+t0XhV?PAe%m{+yR1zSPi zuvf5Tl#9_s_R!3^v!af|lzmsdtR|LEb7sZ0>@q_Yri}bMOhKr?p3{!ynvR0*t7vbB zfnC{Jpgub0g*T@}h7!`RHqNL#)j)jnG_*Ox1E>~&*6Cij?7Av;) zlyn`dTx1@9UK|BQXIqAQpuymj*lNNvy$4M#dkI9AZpOwt0ejpFwS z0#2)0vN;MgY~@meCi+61maswRu~1*3YdHyeZyyPdL=CBrp^Lb?}Cchf#m z&^tWRLb0oH28>F@Eaw%Bwh}jXU^q$hbXt*ub1RXLIlS$H+E zBg^W!l3g{oYnJJjzT;@GdyR<$aZ~v$!WGiWmDEf*Mvjl9C+k7|%B)I836d#z)Y@I6 z`TxAnjrZ4dBrXB-)T+816`%b+xo~_Wc|7sI@;0VV_6G@P%FY|SQ)kXG3G=3TA}B-# z-Q)KR;8PHsrsk(k-gAAQR+LhqY#Tj?az@3654Z;8W(OWp*F6V3!iTilF^m!JFj#pA zl^;nUqr{bsOZYNBz^|S|jbEZIGj@)^#`p!aI)dr(NV^oHb%Z>-Ly9_dx^%w9z~)39 zVNcg*RG|#2znrmviaEsi`4uw3VlljwGJ$O={j%XTerJJ?+5TgCPNN%7Fo>tT>8EV? zGoH*)o0YldvCJ&bu!I-P6+@hMf^vs)4=eK0qs+3z-zdh27_W$NOi=oe#-v0|rT<5b ziohNC|6&TihEFt1Y3xAJ@MK-X(;$MZ+{F7gW|R3M-50pEeu+qi$oIs@>gfF*L5jZg zCHgbxxJ|4EE-=V7a)(PDL&P|e8K?V?@Dpko5|YZ@^jiei84*5{)7nCkka^HN<^+LW z&a@9<{wMWg07Gne8h0^IdaRNbTbyo^GfnaGdz`bFyMQ2oHG(%oD~tugcc0m(89m26 hAH6+*K+u66sDEHc!!r%ff5+4!@2}GR1&@4~{~NIbtU>?) literal 0 HcmV?d00001 diff --git a/target/classes/util/FormatUtil.class b/target/classes/util/FormatUtil.class new file mode 100644 index 0000000000000000000000000000000000000000..88b892c9760e62dc146015c4041cddc54e898e83 GIT binary patch literal 759 zcmaJ5O8{wU&|Z3$|l`*7#Zx#ylcb9R2-e)|Dn3mpp<=1nvvv0%Z#Vi`~HRAu+ZFXdFSG@a8+=r+@0U6OfR3N!dEhhS&nuIM*oyB z_n!vqAjwic=t_OK%Khk$o?+twY{Kk6=J7RGHanY|_1we@8!yqc(ZZUIHr8!yV4XGp zx)WhKmkUKaa6k0U178tp&EXMq@Ia+99&BqHot(;UoVg#9EbcSDmm6!od*gLa4)+Q5 zVdof!&8S=i>d&^uXwEoWPpdP3kAGv7Mct8&J8~cuds$@L?-=58oPi~j`L*cJ0BPGe zPVvs=m3W<4y8(U8%MUr0a?nJDb4_IerZK~78C5)DL^lf*SPoeH4&%65xIxitUt!`J xrS|+aOdTfMUzlJ(i#jXD5fpa7Of~cO{Qfa$;8P7!Mlhe zc)#NPu2r9ku2oQ6JiC1IFZc_5cX|8H%rtGGsAc8MnSJ)zdw+X>dk;VV^}}TV8}W^X z6dq7vXb9nf7=|_Eke4rJ9Y!!JcZXG28jj$oh60K)lr-2Vt9VeuTsSdQ=Dg3FQhI?3`DdmS!FiNB8e%G-|qaEw6773`1S?M*3o?|cg z={E#KnK9DKOzVQ`O};hDP7jtU)pFT(TrRF=Vw9N^u1VpD>2!3@YFAja)6EnP%c}v5D{him zJ;w2@SrUj2yJnFE3mwex-Vy%z)X7MTnUKy%p)f;LahE`BYpxJ5QtS7aBXJ7M@!7RO zl0nCMw2)?35+mbRgGQ=k--f*9s5qnJEZTHDj~7(DsN*GU((y80p~Y#WRq?8h*YG+E ztK$uM8XX+yYTc~jO&xFHoWL5-*?-VV$J;V6kyi1Jj(6pL!Q{PZHP*2X%_`p0@jgCa zUUoAdp&q&1k&%&psNy3XALA1ppW-tC==dC8ux?iZmWlXM#h8w-@b!%IzTqQg&Sjdt zD*?S{X!M_`uq;di$*|9{%ckR!tcp=Co29%!>;LN1Ami*C-x2fUm#eN~mJP>nZH}Lq zYx}J(urM_%q2g1(ItxaHe2`I1c9p>DYX>vcxvB)>HLsuZ;DiH@jm$6&tlDQ zx9LM>_CU)VS*|w@1{@>+s9d7_k67=e^%UDLd;VfHs=d6yF&DPRW*$xoS zXjb|)9LHc0BdK+=)naA4V##Ue4R_hE%#gR|VMFR*rn`F<*c?o8uQU89BS$(XJaaeo z*$`Nknw$(*qwBybe$!I?cnN5d>DTWU@wD2?)TRicg-we0!{%;^!mEeZW1>U+naZHY8QCJ=8O z=f$~5VhPuh{mMBt`ujhH18ZB5#jTOWs5pJY|rTlHit%yihK|m^{ThKwf zI`3^|Xd&8IfZMnWV;eOa5c-?uA}Y44xZPW~L#WuH5JRSh;imvYTcR#8@83WKiEN!p zpF|bMB6^yM>NaBAhI(x0X@=)r)aXPbc3~xU*HAT1L)8|biZKg5s(R+eM-|7KD^WFE z163z>G9+343Q@^=CPnj?h@5Z!9`gmpWW^`2;5?NS<}J?uV)@lr%6A~kwU6?Cp6tUs z?8ib3)W|T8`QJ&`C3Lc2Q^KldJ% z2RZzfU;7CxW+oF$d?t=dwT5e}HBM7oc5Sum0=2*oUsohn1~LZYgKcKN0f$Jv`&lG| z1k90ed6r-Vy*P|PSU8BIsG?W{PawF12?B4OL=W{sli>fr+Hg}7!S^v~UiL*Z6RA>n zsPV^GPiPx^W7TCYtMl!VWaI;)zJ5I19u2oENu}{qtY}HfhFmj{RNAB5x4jEx40Wdz zG4}VbmvF;SOE?)#=oip5zC~$Z-^PVxUdD4c$-E5f1w6r=KS}3Lv9c%G%%|8T&$4+> zlTBv`@+>FB^X#M-$*t40@ESvYoppYb^WvNbc0cR660311r3!z3=Sg-9krxAe%H1GO zI6(P4;7uBZXLnN`rr+JTho=#G-O4md3z8*^5&a8GRopAYpNI<4_&cIKY(~1fuQu^k e(y084aagVW4vXZ_6W+M+hhCX)hbRl-{(k_N+p_f=&U4P$C;98|cOL*;#$yL3a6w|uK@1mCxai;# zF5APEG`_?4_UWp`H3#!paBv-qX(lYCaKph5xS7H&2g|rEaVLcp2Wk8$aaW-4y4!Gr zC4qQua$6v=>{X4xP|Pi zTM#(8Yl3pi_;1 zM=AtFlN{OQFnYZ0*8~P5yoL!1<&7fgB${Dwr)nw`7ZDlQ40PqsRox7gNZgb7iPkW= zuHA;fXzt-rTA@MO-=*Z?9X}MM+{!VI5-%zhHxi|FT(PQ(+5b@>bZ!hQfXPO5d#3#l%^{Rr!&PS9LzCu>uST}QR=c%a#heFZqu`XPSQ=_LBhHW0dPjo(kLr_vF-Dh}V3G z;S|@tFeq`F&nim57dXRH8fTGZ#1`LYc8vSjd&C~RMLd((M{*B+Zy>o&@wq)M-^u z(I__UP?LN=j<1QPFo|zSGRCSwR*w<)JTp%t_74FP5)%@+aGijVn6zr9Fx^oz&qC|B gqJm6jAH(F_wLS9Z9Qp~{wO(Ncv#b#$VVx{|0x)7%L;wH) diff --git a/target/classes/util/JsonUtil.class b/target/classes/util/JsonUtil.class new file mode 100644 index 0000000000000000000000000000000000000000..7132973542ff85ed65c7119d54c4b1ed1ae3a581 GIT binary patch literal 2051 zcmah~YgZdp6x}zkNrs_30x43J*4CB;=qONWOF#`mD+Z`0pop(Yn8v}7$x0?J`_X@d zx)yY`Yxx8GQR+T3AssYmKFr*E&c1v0+4tO=KmL62JAg%er(+Bs=t$$kBnmn-tZDd2 zM;z-KHe~)tl8-fftV73oijz$ppP;B?3)>oYbPNf>5T3~6Qw^VKC@I8hZMUJ2DOTNM zv*xFx0N=$e@ zi^50<9T3abTyXYT^W5ENxlHMqe=f;0yt>RrP)L=WTEp@>En2vcFFy=HyCPTn6cZ3+ zeRjR+9=T;#T;MMB+oBL>&rV&eF1t^-R$(c;stXA%`VarsE|DBseF zayzZ6z2Qj54oXqdk9Vb63|z&8f%|x%5Z^6t%-uIo#;(FGzm@){^9<}^g5C0}?E+!K z`niFJ;6|liC3}rvU>q3@Ul`cO0}WpqI1uQyeuuHpaq5S5%fMIo+Q2vXmL*&`R~Np2 z-mS@+?e#lhUE}-{Hq_)X@cbiCZdp}&bM<0doP&7*jP;Wy9o+4aDal)Pr(#ts^QqPL zq!rA~($4m|qJgH>YTM_t^r6$18{@HeTwiZjttJno!qjxO?}gO$fEFdHE!*-ab>b4} zGH&n=9OLb&kQAFaN^s0==JPeqOuiN0@!T2IFC0WL*#!Y9T;tdX0C*j5aF)WGnCdS6 zndm5E>D+TfiZi3pQ^ZcTW>1k&CxpZ?z{PPwgfhbsND?Q3L5e|K#|Yl?KXILyLBtrj zK}r%bev|JwuHY8lCf9AwMxp-V(ujsT8m6H%WGN?y8Lp99PRJ1Bd-5f;{oH8u49Tt8 zndeAt&-tnbd{x4e=HEliS2amLK%N2ejF2gfS^70ce@tK5A~g)qJ5doKBEtMlsvYyy z&iQI5ahGWMP2wHAOSSVHXL|Sr-z3Q`b}Qi?@OHh2_lS#NiB<5-F(*|N7!eQjUt#1< zF<6{A@loQT?q}{%&yufBz9G@Ttt4lGTPZnhoC)7kzGah=Ia+aLYgX8T9SPX-bYP{o z3&i;x1aTBplOTgs9qH8-LbOP;G%dfm0cxctV|Z!lhBX#Whurx-cKDCg2` ZD%2VVEgh!WBiwXp+Hq!AiHYF-zX9mZw)Ox3 literal 0 HcmV?d00001 diff --git a/target/classes/util/JvmUtil.class b/target/classes/util/JvmUtil.class new file mode 100644 index 0000000000000000000000000000000000000000..1241b4ba85d04cbbce01dd6b0de93b763a135b4e GIT binary patch literal 863 zcma)4%Wl&^6g`tTaj@Ma4W-cXE~QOUsG+a}Aq1#Wz-G#87T``V7X?(ObdL@T3yEX*3Y=0Uv~vX?Y``hkYK)ES@F}{az*v zbuZO2bf1r-L-G$8oIvQ8@yHiR(tDOu_Za5lRB0KBo!3tUR}8D(kdL_=auv7{S3D4r zP}+S}>>{qla2)kiqPgYGLW{t~Wf+>XVS9t2@HNBQEL9M`bF#xW_w^|LNLV_D zQ~MCM-TA-0SN=NWH#U<7Ob%t?6z|Eg6x2_043*?VC~1rJc0tG#(0TJ`j$wW#rKhwA zM9g50d6VN*KZDT&tkDC_z7pu}V3Tzya>+CDmF^d?&v|){Y&B1s zsMEhQX+Q%_ik2{s7G*MUpU6t&myc0;(fx`tgSXK#j!-FY9iw^#^AlA|$QbJ=lWoEv cw2iYl^CHy@EK;;UHJc`!qbL(}KF3}71tJa3wEzGB literal 0 HcmV?d00001 diff --git a/target/classes/util/Logger.class b/target/classes/util/Logger.class new file mode 100644 index 0000000000000000000000000000000000000000..8c10146390e3541e1efcb778457df84a5cea6d4f GIT binary patch literal 2268 zcmd5+T~ixX7=BK^b_q+13!%1RiM3z|q-iNtTUxA8Td4`fhHq%=5|*&AWMQ*$WTuz? z27iDv4%5qekuo~=(hL0u{uD>8&)H2XAzXRkNQSfLyyu+veV*ric7OTnhnE0GQH~>q z8*&(n<0fvY7+3L;g4=O?j0qWt0!q;-duG{d-Y$5qRW31a*r{@>qu?3E?Yyz;gHW(Y)K+=J;eK(0`#q_Z z*4%zsi>0S{+Hgxm&~?HwfwM>M28Ac8mc341lv}|F*_p2ExJ(6w>2zbnHV*!U|9eHTK~x9O7iJ=GTC2A3UnS1{e> z6Wegy9fK-fKWder!q^G@IkDmq2@Crb&t&yPfXs5TGxUzfgr>1Wa9zH7&0*SZS01v< z#~fRSA*~ZLc6ZG(0cTFY*$S#*nI;KmHwl6%I*L`-rO6xXW*vhlp(>PW+Ss9~di>e8 zDTSM~jY_4VUYJfi2C4CuwRENd3Gd)7eqQ8XjBcbwIiBY#%O?$rX!-@jb526&s~-Z| zkmOto4lu<9uG;V}F4ix9gDAp`T@g8v{tl!b z2sQsb+JqYND1v?ra1|ov_mColL8$ys zF_LDy4WU1vD;NqfIQ$ypuf!PP_Tq^ce?8bi-DnZ@5s;4IIlxZkxc WzMk7Y*x>8XS9i0(hfEg2^}hjggvXEo literal 0 HcmV?d00001 diff --git a/target/classes/util/Print.class b/target/classes/util/Print.class new file mode 100644 index 0000000000000000000000000000000000000000..095571a0e4a2095e21b4ead6928f561cbe89ab06 GIT binary patch literal 1450 zcmah}?NZY~6g^8zlg98Bz62F2_|Z~B{Qy)zRH`Ui3Q|BF#~+~t8cY)=O`UPZf4+rp zp+5?vjt}6=_y&%5leA5N(f+u*d-v`+=bqj4*Pm}c0ZieQgh8a^xCT|iBr*c7ONb&Z z;RbH<*)0)Me4OTChS%KYdv`?Kl`xAr9_B^d5Y5^i&SneDH zvl;r6xqa=umN7MJFSEM6uNU1pj?buEIl0Bqwo9iXMINKBH_*auEiSmkutyBh5-~AI z1-t4L^(BJ~lsx)L&MM<9h6Fs8v4kfAp2}E8f?=?!$VXbN8s?7f2zVyrIdU>qkSB?= ze6lKIji;9JLdH6Blz$_jAY%iYGPbd0G=-tN$?dz* zk}7Fu9d0lUJs)+%^)0b+f9r1J;HT;*Ce+M+uEc{Vd&V? z-K=JsE4o{fo{>h8os$;`{aqhI#ShAU%%-S49$AcwSClMkEBjT zk3NvXP*4M4A`B_pZ5L{j>(;FG^X76zc>gP@2M2sK`VRKuC$*h8daIE0-D zuv577Z*2Mh*kgn}ek%6m2KFb?&3k+jh*mlX_XwReba8@iZ`H%63I*yR*K9D&)4dc< zYp;`lfizO|m$(GglQG~^HCi0O6<}GQQh@#+1z$o zZGq%=!|glMPyAlDVedQAM>cXUr>x6$3>e55(2+K+{&@Xq za%rY|RKKztfq>@OcY)~<4TTC}@xTgbEN0cOdFv$44+swCXd;!EP8f%nRrw0O@wFF- z2Lc6I#zaJ7nAqs!9P-Rk(k~hLd6V7pbLJ6B@fopKsOsfCi9wOvfJg?T7z;(lG0_*< zVYec=sbcdL@!~&$QYbJMHDNLokUok;JU^y>mst#Zfb=^O7cbDBpvaYYO2%j9OvV>Al|RU@v4f83A76N7U&7&QD{aHMl%+$ zC}c}2OtHD7A|sq!7D6k5?O0C0MoC3k#cK*;OD1EZHZy9aGS= z`Y=h~TiVhqm72?@g4kvCWron+i0>bZFH|i{8gvpNt6w$*=LQrJ$h7Sm&I0)`;GVt! z0nc)*KL{>G3YuNr5v&9U1)J9$QlObN*qq^tynFfa(n$ehRx8zf#;j1+7SIU^m5EBV zY&brAXJds{%C#zW-0ydMV1kEx0(kT_zLAx%>kZfmzYjEQ$%#77>SeDxR5&Us>_P=i zIdjq0-KxVPq}HWQuvwoy$+68guFg57Yb(<>o5U^Klqgo}sXgCVC2JpNxWjqD5 z+9n+byDGU+3q{K!eBQBjN|~WVu2gjj#-u4OX?x=p92UW7*oj>#Tn$xR(Qp;lRIF&Y zj$RF~qgO%b{IH5QG`xwoNVp!qyq`y^ro~V+yp4AhD5Dx~h(pRS`?=n$Q+j2IJ*43Y zysP3p4e#RvR$s%1_=t_5;bVNF;ZxjXi`PAP8PV_=KG*OCZff`vUkQjOReY@>jc*vy z29t%!t7FtE*HS0r-K5s~-oHNeGxJN1p>rO!6snHH(Nfzt&L=5lsl@H~TH6~(3cC9m z+O@8#PpWNoXY14wP!1?LceL7!klR3XvIb&AmMxPrU~jPb{Q-I(8Go$B^m5s-8RXDL zM*?lxP-aFOcS|*|%*VQ}6RlfM?P15!S2)^YdPQcrr!RQIze4`a^GfMYu1Lka&W7bj zXIh*t77tsNf-aw{XPGWp{^w+@|EymHG42X-nzlE5OuSYiH`Oh9oD}qJ$YcX{47rwn z1+BHEyr_awaBei-;lO37O#^RODaZ$t9y}EEFF6NFQ3H9X*@fNwmha$S1P}v1p4i1_ zH+Lg^D||->ZbA8(ix5qv5zvOmxYncr9>*T;n$Uw@|8R!ZAY7O}YBHqb^LF8yMwhA?K7x6Q< z(3DEuixlZEk!|9*$iDafAwj&L!`w=?=j zW(QZ%l^wi|M@J(=U6IsnY#WVsMMZ#NFThSjxjx6|1tf5hB=Zci-~}=vaTxj}ZHUO= ur|2b$tzK{;o=7qg$B5O&i!#F$M0h&Pq)gIE1ShVK)McqtaGbIb=Kck(pW<== literal 0 HcmV?d00001 diff --git a/target/test-classes/META-INF/MyNetty.kotlin_module b/target/test-classes/META-INF/MyNetty.kotlin_module new file mode 100644 index 0000000000000000000000000000000000000000..8fb60192d378759239a3ecbf60eac8c8de446e9c GIT binary patch literal 16 RcmZQzU|?ooU|@t|UH|}6022TJ literal 0 HcmV?d00001 -- Gitee From 2b0cf52b5bc63ad010fccf2162a1850befda28ad Mon Sep 17 00:00:00 2001 From: pengfei Date: Thu, 5 Dec 2019 13:50:50 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0.ignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 31 ++ .idea/compiler.xml | 1 + .idea/vcs.xml | 6 + .idea/workspace.xml | 521 +++++++----------- .../java/com/zpf/three/NioReceiveServer.java | 1 + src/main/resources/system.properties | 2 - target/classes/META-INF/MyNetty.kotlin_module | Bin 16 -> 0 bytes target/classes/system.properties | 2 - target/classes/util/ConfigProperties.class | Bin 2441 -> 2437 bytes target/classes/util/FileLogger.class | Bin 1928 -> 1924 bytes .../META-INF/MyNetty.kotlin_module | Bin 16 -> 0 bytes 11 files changed, 234 insertions(+), 330 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/vcs.xml delete mode 100644 target/classes/META-INF/MyNetty.kotlin_module delete mode 100644 target/test-classes/META-INF/MyNetty.kotlin_module diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..190ca23 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# Created by .ignore support plugin (hsz.mobi) +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +target/classes/system.dest.properties +target/generated-sources/ +target/generated-test-sources/ +.idea/ +target/ diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b4ddc0c..6165f41 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -6,6 +6,7 @@ + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1635bef..ecd3ac2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,19 @@ - + + + + + + + + + + + + + + + - - - - - + + - + - - + + - + - - + + - - - - - - + + - + - - + + @@ -63,129 +72,38 @@ - - - - - - - + + - - + + - - - - JAVA - java.nio.channels.ServerSocketChannel - - java.nio.channels.InterruptibleChannel - java.nio.channels.SelectableChannel - java.io.Closeable - java.nio.channels.NetworkChannel - java.nio.channels.spi.AbstractInterruptibleChannel - java.nio.channels.spi.AbstractSelectableChannel - java.lang.AutoCloseable - java.nio.channels.Channel - java.nio.channels.ServerSocketChannel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - java.nio.channels.SelectableChannel - - - All - private + + + + - + - - + + - + - - + + @@ -207,10 +125,12 @@ getProperty + + - - - - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - + + - - - - - - - - + + - - + + @@ -314,19 +212,22 @@ - - + @@ -281,7 +285,46 @@ - + + + + + + + - - + @@ -353,8 +404,8 @@ - - + + @@ -458,6 +509,18 @@ @@ -475,7 +538,6 @@ - @@ -671,8 +733,6 @@ - - @@ -688,7 +748,6 @@ - @@ -783,7 +842,6 @@ - @@ -795,7 +853,6 @@ - @@ -821,20 +878,8 @@ - - - - - - - - - - - - - - + + @@ -859,80 +904,83 @@ - + + + + + + + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - - - - + + - + - - + + - + - - + + - + - - + + @@ -941,10 +989,34 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/zpf/four/reactormode/EchoClient.java b/src/main/java/com/zpf/four/reactormode/EchoClient.java index 19001a3..2e61e25 100644 --- a/src/main/java/com/zpf/four/reactormode/EchoClient.java +++ b/src/main/java/com/zpf/four/reactormode/EchoClient.java @@ -1,7 +1,6 @@ package com.zpf.four.reactormode; import config.NioDemoConfig; -import org.assertj.core.util.DateUtil; import util.Dateutil; import util.Logger; import util.Print; @@ -9,7 +8,6 @@ import util.Print; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; -import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; @@ -24,7 +22,7 @@ public class EchoClient { public void start() throws IOException { InetSocketAddress address = new InetSocketAddress(NioDemoConfig.SOCKET_SERVER_IP,NioDemoConfig.SOCKET_SERVER_PORT); //获取通道 - SocketChannel socketChannel = SocketChannel.open(); + SocketChannel socketChannel = SocketChannel.open(address); socketChannel.configureBlocking(false); while (!socketChannel.finishConnect()){ @@ -32,7 +30,8 @@ public class EchoClient { Print.tcfo("客户端启动!!!"); //启动接受线程 - + Processer processer = new Processer(socketChannel); + new Thread(processer).start(); } @@ -94,25 +93,9 @@ public class EchoClient { } } - - - - - - - - - - - - - - - - - - - + public static void main(String[] args) throws IOException { + new EchoClient().start(); + } } diff --git a/src/main/java/com/zpf/four/reactormode/EchoHandler.java b/src/main/java/com/zpf/four/reactormode/EchoHandler.java index 4f84e03..3dce406 100644 --- a/src/main/java/com/zpf/four/reactormode/EchoHandler.java +++ b/src/main/java/com/zpf/four/reactormode/EchoHandler.java @@ -1,5 +1,7 @@ package com.zpf.four.reactormode; +import util.Logger; + import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; @@ -23,22 +25,34 @@ public class EchoHandler implements Runnable{ //将handler作为选择键的附件 sk.attach(this); + //注册read就绪事件 sk.interestOps(SelectionKey.OP_READ); - selector.wakeup(); + //selector.wakeup(); } @Override public void run() { try{ if (state == SENDING){ + //bytebuffer 此时是read模式 channel.write(byteBuffer); - - + byteBuffer.clear(); + //bytebuffer 此时是写模式 + sk.interestOps(SelectionKey.OP_READ); + state = RECIEVING; }else if (state == RECIEVING){ - + int length = 0; + while ((length = channel.read(byteBuffer)) > 0){ + Logger.info(new String(byteBuffer.array(),0,length)); + } + byteBuffer.flip(); + sk.interestOps(SelectionKey.OP_WRITE); + state = SENDING; } + //这里重复使用 不关闭sekectKey +// sk.cancel(); }catch (Exception e){ e.printStackTrace(); } diff --git a/src/main/java/com/zpf/four/reactormode/EchoServerReactor.java b/src/main/java/com/zpf/four/reactormode/EchoServerReactor.java index df0a758..8551976 100644 --- a/src/main/java/com/zpf/four/reactormode/EchoServerReactor.java +++ b/src/main/java/com/zpf/four/reactormode/EchoServerReactor.java @@ -1,9 +1,15 @@ package com.zpf.four.reactormode; +import config.NioDemoConfig; + import java.io.IOException; import java.net.InetSocketAddress; +import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.util.Iterator; +import java.util.Set; public class EchoServerReactor implements Runnable { Selector selector; @@ -13,25 +19,79 @@ public class EchoServerReactor implements Runnable { selector = Selector.open(); serSocket = ServerSocketChannel.open(); - InetSocketAddress address = new InetSocketAddress() + InetSocketAddress address = new InetSocketAddress(NioDemoConfig.SOCKET_SERVER_IP,NioDemoConfig.SOCKET_SERVER_PORT); + serSocket.socket().bind(address); + //设置非阻塞 + serSocket.configureBlocking(false); + //接收accept事件 + SelectionKey sk = serSocket.register(selector, SelectionKey.OP_ACCEPT); + //attach callback object + sk.attach(new AcceptorHandler()); + } + @Override + public void run() { + try{ + while (!Thread.interrupted()){ + /** + * *

This method performs a blocking selection + * * operation. It returns only after at least one channel is selected, + * * this selector's {@link #wakeup wakeup} method is invoked, or the current + * * thread is interrupted, whichever comes first.

+ */ + int select = selector.select(); + System.out.println("select=====>"+select); + Set selected = selector.selectedKeys(); + Iterator it = selected.iterator(); + while (it.hasNext()){ + //reactor负责dispatch收到的事件 + SelectionKey sk = it.next(); + dispatch(sk); + } + } + }catch (Exception e){ + + } + } + void dispatch(SelectionKey sk){ + Runnable handler = (Runnable) sk.attachment(); + //调用之前绑定的handler处理器对象处理 + if (handler != null){ + handler.run(); + } } + //handler:新连接处理器 + class AcceptorHandler implements Runnable{ + + @Override + public void run() { + try { + SocketChannel channel = serSocket.accept(); + if (channel != null){ + new EchoHandler(selector,channel); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static void main(String[] args) throws IOException { + new Thread(new EchoServerReactor()).run(); + } - @Override - public void run() { - } } diff --git a/src/main/java/com/zpf/four/reactormode/MultiThreadEchoHandler.java b/src/main/java/com/zpf/four/reactormode/MultiThreadEchoHandler.java new file mode 100644 index 0000000..c48034c --- /dev/null +++ b/src/main/java/com/zpf/four/reactormode/MultiThreadEchoHandler.java @@ -0,0 +1,88 @@ +package com.zpf.four.reactormode; + +import util.Logger; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.SocketChannel; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class MultiThreadEchoHandler implements Runnable { + final SocketChannel channel; + final SelectionKey sk; + final ByteBuffer byteBuffer = ByteBuffer.allocate(1024); + static final int RECIEVING = 0,SENDING = 1; + volatile int state = RECIEVING; + //线程池 + static ExecutorService pool = Executors.newFixedThreadPool(4); + + MultiThreadEchoHandler(Selector selector, SocketChannel c) throws IOException { + channel = c; + c.configureBlocking(false); + //仅仅取得选择键,后设置感兴趣的IO事件 + sk = channel.register(selector,0); + //将本handler作为sk选择键的附件,方便事件dispatch + sk.attach(this); + //注册read事件 + sk.interestOps(SelectionKey.OP_READ); + selector.wakeup(); + } + + @Override + public void run() { + //异步任务,在独立的线程池中执行 + pool.execute(new AsyncTask()); + } + + + //异步任务,不在reactor线程中执行 + public void asyncRun(){ + try{ + if (state == SENDING){ + //写入通道 + channel.write(byteBuffer); + + byteBuffer.clear(); + + //注册read事件 + sk.interestOps(SelectionKey.OP_READ); + //写完后,进入接收状态 + state = RECIEVING; + + }else if (state == RECIEVING){ + + int length = 0; + while ((length = channel.read(byteBuffer))> 0){ + Logger.info(new String(byteBuffer.array(),0,length)); + } + //读取完毕 准备写入通道,切换成读模式 + byteBuffer.flip(); + + sk.interestOps(SelectionKey.OP_WRITE); + //进入发送状态 + state = SENDING; + } +// sk.cancel(); + + + }catch (Exception e){ + e.printStackTrace(); + } + } + + + + //异步任务的内部类 + class AsyncTask implements Runnable{ + + @Override + public void run() { + MultiThreadEchoHandler.this.asyncRun(); + } + } + + +} diff --git a/src/main/java/com/zpf/four/reactormode/MultiThreadEchoServerReactor.java b/src/main/java/com/zpf/four/reactormode/MultiThreadEchoServerReactor.java new file mode 100644 index 0000000..20aaeeb --- /dev/null +++ b/src/main/java/com/zpf/four/reactormode/MultiThreadEchoServerReactor.java @@ -0,0 +1,131 @@ +package com.zpf.four.reactormode; + +import config.NioDemoConfig; +import sun.awt.windows.ThemeReader; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.util.Iterator; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +public class MultiThreadEchoServerReactor { + ServerSocketChannel serverSocket; + AtomicInteger next = new AtomicInteger(0); + //selectors集合,引入多个selector选择器 + Selector[] selectors = new Selector[2]; + //引入多个子反应器 + SubReactor[] subReactors = null; + + MultiThreadEchoServerReactor() throws IOException { + //初始化多个selector选择器 + selectors[0] = Selector.open(); + selectors[1] = Selector.open(); + + serverSocket = ServerSocketChannel.open(); + + InetSocketAddress address = new InetSocketAddress(NioDemoConfig.SOCKET_SERVER_IP,NioDemoConfig.SOCKET_SERVER_PORT); + serverSocket.socket().bind(address); + //非阻塞 + serverSocket.configureBlocking(false); + + //第一个selector负责监听新连接事件 + SelectionKey sk = serverSocket.register(selectors[0], SelectionKey.OP_ACCEPT); + //附加新连接处理handler处理器到selectionKey + sk.attach(new AcceptorHandler()); + + + + //第一个子反应器,一个子反应器负责一个选择器 + SubReactor subReactor1 = new SubReactor(selectors[0]); + //第二个子反应器,一个子反应器负责一个选择器 + SubReactor subReactor2 = new SubReactor(selectors[1]); + + subReactors = new SubReactor[]{subReactor1,subReactor2}; + + } + + private void startService(){ + new Thread(subReactors[0]).start(); + new Thread(subReactors[1]).start(); + } + + + + + + + //反应器 + class SubReactor implements Runnable{ + //每一条线程负责一个选择器的查询 + final Selector selector; + + public SubReactor(Selector selector){ + this.selector = selector; + } + + @Override + public void run() { + try{ + while (!Thread.interrupted()){ + //会阻塞 + selector.select(); + Set keySet = selector.selectedKeys(); + Iterator it = keySet.iterator(); + while (it.hasNext()){ + //Reactor负责dispatch收到的事件 + SelectionKey sk = it.next(); + dispatch(sk); + } + } + }catch (Exception e){ + + } + + } + + void dispatch(SelectionKey sk){ + Runnable handler = (Runnable) sk.attachment(); + //调用之前attach绑定到选择键上的处理器对象 + if (handler != null){ + handler.run(); + } + } + + + } + //handler:新连接处理器 + class AcceptorHandler implements Runnable{ + + @Override + public void run() { + try { + SocketChannel channel = serverSocket.accept(); + if (channel != null){ + //多线程处理器 + new MultiThreadEchoHandler(selectors[next.get()],channel); + } + + + } catch (IOException e) { + e.printStackTrace(); + } + + if (next.incrementAndGet() == selectors.length){ + next.set(0); + } + } + } + + public static void main(String[] args) throws IOException { + MultiThreadEchoServerReactor server = new MultiThreadEchoServerReactor(); + server.startService(); + } + + + +} diff --git a/target/classes/com/zpf/three/NioReceiveServer$Client.class b/target/classes/com/zpf/three/NioReceiveServer$Client.class deleted file mode 100644 index dcc410f0deab36ba578f3cad663f823f02f85ab0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 586 zcma)3%SuBr5Iw22FRQJO`hG1G9}BZ_r-)Jzlv2Tp`}B6&n|hl_ZrX)^nQK->xxW3QZl&`HOvqk;8w)#*5jV}Z@_1VdilFtlv&M1E3DX4#>yhsqd= z1a>A`ZDlad#qyeWO$02@ool20g}~I|(W5}NZaciQ($I#Q!$F(egK9^qZyTuSQ8}I5 zC&{c2H9N}HBTdE&ly7*gt4Au1iSq}Izz*cgb65J%5y_^u_Y{yGQH$J&+}^k^G2OC5 z7f@nNp!QpLk~~=%vzW_cQ(*sJQw6F&FMZeUQ@{qd|8B)DGW>7AG%k^41al7glnW^X zMU?ms%%IFD_^>hN3P+MT$xI)=LA-L1L6tF=Cf6{}ad|Aj0%~b}ImHz$F_*ZO!5S7( F_y!A|kBI;P diff --git a/target/classes/com/zpf/three/NioReceiveServer.class b/target/classes/com/zpf/three/NioReceiveServer.class deleted file mode 100644 index 7d7fd8ee2a30579bd661e7dd5abb57bc0bbb6ce9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6153 zcma)A3w%`NmH(e)CU@rM#*pxku{?rA3=oJ_1ezd9LQ*0jiAf*@YU$17CR~}!#F;x( z-0iM?Sga4K);_SU(wFH|3zZ>=wY0l^Zr6Ra`>@-$plx@z-A8wI+lBp~duNgv3AR7N zcklfk=ls8O{^xw>n{S_c>KOoQBw=DV9*bbY#HaA-C@S%pC_anNnfN>&*Uu*me8EHn zkLkxz1IJ80AJgWGCZ5D`6LrXGbHc!+E|($-s9^)T_!h_{%8Yo~^`R;jaz+jfv&j zy&QiV!QbigyV`uu#NXo|RMkb9}_R(Wdr}Kn0{-b2ftGt{}<()a}k_31tJkCi%2>9B@~e`RY-*)hM=M?;W|lA zV09*wPP#2&XEIJkV8r*@>5RjH%ero{_uEZLH`SEyYibL|TDW{DJ2K*=1#_oowI1-C zR==AQqH$mTHhWx99n8skZlZ}DI@<4!CT%a9b_6$3SOl4ZC5I8CwACrSHJU}A#blstJM7-eN+<~v)!a%Uc>HS0|`4h z+SKo*-Q;MCuh&kGQqt@hh6S@|<&q5u%=X*j&ba5Mk{N?uL}kXa(_XMWZYtyNQ*h;s z=29EGYhm?WNKb8p-(HPmyd3E(*b)Srr&1zh!dS9v)6R8Ct!t(D9l&la3dd zW>YXq74u46e_*`e{=@^EGWQx%$z;gvMXL9wvgx>^8YtwIvAkM0YGDMUg7Ef%j#cXou`H>QODwzzdkm?z zWELJZq{fn3nQh_Cumv@~d3-Kyu`_$=2@6Ar3l_aPGc9-+rN1nhBXhNxXUU~9pXo4Q z|4aZpL$x%owXzuQp_{C3UjI zlFMbOCG~QJAUPLyP)n|s zYb;rVcN%i7C2M7!;8I^r5%XHJZerL;Te4nW$ISZTmmfKM=#yvfy8q1Gk8&g0-E2vV zY%t_HOE&73t|w+3!h0;a0i%{|l2*au8PFG}BTL$3vnB1)Vae(Bo&196bB} zgU_GJ3Fa3|=*fEHS&zBgvBy-}4oe2*4VLW02Q3`N!C2zvRgmC8R zJI+kp6Ua7Xk0o!G4yONU+f7A?CAJ!2NSn9}TMVTU3V43s<8Sa)Yn9sdF-XP@}&3lk5Xecu=S3F~Da z51(mFJwvxJX%t}6fSo;4FsDM`LRxEXuJxsqB<~W@!BJSS>GPzQ#SzIC^5P>YCjMfd2SoG>Czd)|{rUA!#5^j3 za5J0YTAl@^qZZAY=2`d@=I04socv4OR$==B^yr__3B{?8_-2hdULTq5Ir*}M;W)MM z0=Loz>C(wXHt}ona%MEa`Wb8?)aa?vDo+9+IdLOc;@f%$o9r75LlIoTQ-Nw~ZLRSY|E|Ju=bk*U+Ut&MlA zDFwlCp>n6Y2__%$eeG@Sojcn1^llp1Qm{g2&vst3cnbS`$@qm;P!X2w`J#5GgGvIi zFpXDb1q1@v$^5I^X&aFoUrIt%+yTXvVPOPV=FFFbZKu5n*IuDQ%F`Ulc>oI_STk;*tX zWnIThum+zuz0EcqP+IzXEhqG;(wRo^lOnCoT7w%42vFM1WaVp1@F1$;UOQ6hG22so zdho0NZoJUol(k@{{z6=034hbr&7W?{QKn@z-^#R-<`Y^tLon?3ISBEc)i~R|?Agf` z!spTzCm<_o%O+8N9HAA*5S~QEaTqI3A+qxXqQ_w#^#!yYFgkWL;+mR-;hYbI-*bfwx)l!1Vk)KZTzBGyIZH?tQ%o;p}nw`f`djhk&8&~BpXRvYQ ztXVnC8?3!_67vZn_6UyhaoI_{M$jCJg-(JufWtVfZwm#dF}FD!3+J%tFvj$`_%!O8 zD`FKnENM1k#y3zgasE3ogW4`1j2SCKIV^3CoI*W!c|~(H7L6G>EIW;woU_6o&tYY4V-7^PdJ;_&s8LN<9Y%CTEPMj5RV-HvCeFtv&UdTTLQprP zv4HI=el^iPSK$&|jTo-MVyvT6)}s+E{JIVs`ELtuzyLPkjcB9yH`6ukT;G8#UGvA- ziaW856@528#NVMljb8o^cN3mPAHK^~-^X_R5IgV_4EmlKp`}M~GuQ4%1tsmkTW}i; z%GihlxSd!I;adC=I@;k9C96 z_$1aph6nkbpZU5Rnw!JN&@zb)%@wC`-OgCW32an`Fn~gE^IJQh+ZIrM&A9@%| z0-QIl3pdWAzRt!;Y(0*y+HF3!syS;*Fr#}gcwRd=aen>;s++?!L9ZgY>FC^0*%2gk z?j-t-p}%$@hwVCCfVYFl)DA@e1KfkbK<6ahFf~R5>%xVVJJ~%i%(Y!k4!Z)*AEkE| zNVU|Gf8{>AKSoc3nXHC+EXGW>fLW}bS?p>!XlC5E(wlwc<1TW^VP+WPzYKH50p^Jh z()Uj=J3K{>ev_Baq$zyoqC9+dm=kRJ_)7J1z*2>u+p4Sdx9``Amkd0C~|YT)CQzx9*zCurj` Qe3H=&Y8P6#k~t#s|0(>bNB{r; diff --git a/target/classes/com/zpf/three/NioSendClient.class b/target/classes/com/zpf/three/NioSendClient.class deleted file mode 100644 index 06b51f2b4be72298cccf973e86bd7befc7fc3b81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3455 zcma)8Yj_-08GcW)*_oY8Z<{7$d$E^DNqP&Vm}1(X%{GBew@I2SDQev8PLgRiyX)>O zZ4sqjN};8QA{1(E3yMJ$Y9ef6Qwv@}R8Uc#hrimy{_vmv(nsTaW_Gg)Nqx+-Idd-G z{r$f0oVWgS`6__h@t%eq=u;8a5P{+0PQM2O7}Q|mpn^jh6nPw#-yu1~G{ljRG@ntC zRFKlJ1eP4qD(+KoSVIYp$l<7l`|(*hJfPrnlH>Docu+$*j%oM;z9`SWq~go+dtAjs z(uNaq@vtO(M8ip(l9C^lv(s{TOb%aB@wkSs;%h3ND54kgFCuOGx{4>I;ZI2!XH-0` z;28yHHG0)2hi@o2C!mA}L&=n339JYn4BZ#1j+yc5>|V9sIom1V-ety2>rR2f%Bn5_ zmp>jc1eOHNn9-ab>NAoZp}r`0yuo-l6zvKnO}Wl)x~xGnC9paejt^DepXjf)29t(S z-E79&jabAVHI0}>9cqfJMpKH>Qt@;$Y_x`~K`GNVEEP?x+zPkWPvK1CU6@2aIHju@X(RqTLFG5A6#j z>@X5K1>a`n@s{DD zCv$+=Dub`17Bsu4v!ij#9SWY+@f^OT;|_dO!MAlh55I!%=orQe0yljSt@^YXjmT(t zvY4%{)A3!rsN;M1zJix@yo^gaegHp7a$wd8=(eCNiqe7+9i#Xm({Adi6W1m(*Tzpz zzV!6uxfz{V(m*VcwwNeJXh?FsqT^L$7&0AW7}xP5TxPP{vSWr-9pK<#xjPa`8mW|y z3HWtfL968cv4X2QUc>7;euAG0ta3uOcIx5BCr@6u{@VGe$DW@$cY5;Vvy;!fpyOxK zKF{?NFHW5~b#0uk{T#p0@k_j+<4v>@G#$UfTRK|sYaPGAZ*{zlcXa#??=bF@SB^~% zpSpJC;`OUfI4%-v9lysL0tFAOl|lQ10Cc>IKkE1s#szMxoBNlIj4fjFewyuUz%rZ={snI*)?WuIkm|;cVg@Gk$L6C`kQ|~r^E`Phe~10(FqD!m!iPa-8&Oc{m>HHwR=l+G7mG{q~A} zwYT{9Hgxp1H#G0*Z43k(*hSKo8LbYqbn?R_95AdlV|Jg~aAVc8tCD3GN+j6o1h)KN z9NGGzt*RBz1$lX8)qF>DHU{GZ>?5q#h|!lGU>lmP$3bqVYz`$^C)*nQ4S}wPteTH1;gOcx>ITIz24E(%QphvDaBOy?+AnBZ}AhA1T z_gvaNL(U{{sCb-*tgWk|tvArhlA1x$-fC@W>yW*2e&hnu!6i8$v zGWMrU!-^iw<3@pgc_3qGM}Ki@Fl|NRhhr^iizZ?nUpG7W3}V-mR}^Q3obv|bxQnY@ z+-D!f;*Dbv8@&bND0~&J5$+VAj-$peuoNyV!=0Sz4mCc8k8>qtFLWdo`~^ikh1ffa zqTr@+xc5y!=^2CS^<O0igA3nR`sb;+szql==P}@+|o?~e%ITp%5HBJ1r*kJ zJUcXBkv!PgQ{y?0yBDG@(@H(ZLp!vbdzA!(UEVeDGie)?gJXu$lm`fgfwJ zm%z7TJ@(^f^kM^_&$r+xd5)n9$FT{gu^CU|R$Ra~zErm364T@|YVbOfHR!D1twui9Wb#-!OvM$0z(HoIx{Z zDs4*e&Cp7}-^UR3v@uDUcG;9{r`CI*PV=BhL5G6Q+^-AxH?}M2R&dXfX(})Nz`1jz zpoc%<0{(^lrPEX`NGFE_pw4^o2`AxcX@QN;q6ys2JpV|LaM$E3XEB`v8C7($F1qY+ ZlsOFeBtFG6m9F+OsC?q$(_9xI^j~*pl@0&^ diff --git a/target/classes/util/ConfigProperties.class b/target/classes/util/ConfigProperties.class index 6637f49be56ecb8155cdecd2634036244c1f758a..3d895fbf206193e73636fdc3e855214e56d5719d 100644 GIT binary patch delta 30 lcmZn_?iAk8z{bcwxsk1m*^YsK@-H@1W=962&3f$NOaO$v2igDt delta 26 hcmeAaZWZ3pz{bcuxsk1m*@}U0@-H^i&Bp9uOaN$l2VVdH diff --git a/target/classes/util/FileLogger.class b/target/classes/util/FileLogger.class index be2bf133a640d678956f1dae23ac3b8060c84639..919826dbd030c1ffb3e1abcd911c639990aeba75 100644 GIT binary patch delta 30 lcmZqS@8I7M!^)^SIhM7H*^5DF@+($H=1>OL&01_xi~xcQ2i^bx delta 26 hcmeC+Z{gn%!^)^QIhM7H*^NPP@+(%y&H8MSi~wae2Rr}( -- Gitee From 5b4d70faa1e78e348c71f35f391e8446547f5149 Mon Sep 17 00:00:00 2001 From: pengfei Date: Wed, 11 Dec 2019 17:15:43 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=85=A5=E6=A0=88?= =?UTF-8?q?=E5=92=8C=E5=87=BA=E6=A0=88=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/compiler.xml | 4 +- .idea/workspace.xml | 750 +++++++++--------- pom.xml | 10 + src/main/java/com/zpf/five/FutureDemo.java | 117 +++ src/main/java/com/zpf/five/JoinDemo.java | 81 ++ .../java/com/zpf/six/netty/InPipeline.java | 94 +++ .../java/com/zpf/six/netty/OutPipeline.java | 91 +++ .../six/netty/PipelineHotOperateTester.java | 73 ++ target/classes/util/ConfigProperties.class | Bin 2441 -> 2437 bytes target/classes/util/FileLogger.class | Bin 1928 -> 1924 bytes 10 files changed, 864 insertions(+), 356 deletions(-) create mode 100644 src/main/java/com/zpf/five/FutureDemo.java create mode 100644 src/main/java/com/zpf/five/JoinDemo.java create mode 100644 src/main/java/com/zpf/six/netty/InPipeline.java create mode 100644 src/main/java/com/zpf/six/netty/OutPipeline.java create mode 100644 src/main/java/com/zpf/six/netty/PipelineHotOperateTester.java diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 2f9f096..f124e3a 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -6,9 +6,9 @@ - - + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 375783d..34be24e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,17 +2,14 @@ - - + + + + + - - - - - - - + @@ -32,8 +29,8 @@ - - + + @@ -42,98 +39,148 @@ - + - - + + + + - - + + - - + + + + - - + + - - + + - - + + + + - - - - - - - - - + + + + JAVA + com.zpf.six.netty.InPipeline.SimpleInHandlerA + + io.netty.channel.ChannelHandlerAdapter + com.zpf.six.netty.InPipeline.SimpleInHandlerA + io.netty.channel.ChannelInboundHandlerAdapter + io.netty.channel.ChannelInboundHandler + io.netty.channel.ChannelHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + io.netty.channel.ChannelHandler + + + All + private - + - - + + - + - - + + + + + - + - - + + - + - - + + - + - - + + @@ -150,6 +197,8 @@ getPeopert + select + netty getProperty @@ -167,7 +216,6 @@ - @@ -238,14 +293,7 @@ - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1575383983287 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioReceiveServer.java - 104 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioReceiveServer.java - 128 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioReceiveServer.java - 122 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioReceiveServer.java - 113 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioReceiveServer.java - 84 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioReceiveServer.java - 60 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/three/nio/NioSendClient.java - 72 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/four/reactormode/EchoHandler.java - 47 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/four/reactormode/EchoClient.java - 78 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/four/reactormode/MultiThreadEchoHandler.java - 45 - - - - file://$PROJECT_DIR$/src/main/java/com/zpf/four/reactormode/MultiThreadEchoHandler.java - 58 - - - - - - - - - - - new String(byteBuffer.array(),0,length) - JAVA - EXPRESSION - - - socketChannel.shutdownOutput() - JAVA - EXPRESSION - - - - - - - - - - - - - - - - - - - - - - - JAVA - java.nio.channels.ServerSocketChannel - - java.nio.channels.InterruptibleChannel - java.nio.channels.SelectableChannel - java.io.Closeable - java.nio.channels.NetworkChannel - java.nio.channels.spi.AbstractInterruptibleChannel - java.nio.channels.spi.AbstractSelectableChannel - java.lang.AutoCloseable - java.nio.channels.Channel - java.nio.channels.ServerSocketChannel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - java.nio.channels.SelectableChannel - - - All - private - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JAVA - com.zpf.six.netty.InPipeline.SimpleInHandlerA - - io.netty.channel.ChannelHandlerAdapter - com.zpf.six.netty.InPipeline.SimpleInHandlerA - io.netty.channel.ChannelInboundHandlerAdapter - io.netty.channel.ChannelInboundHandler - io.netty.channel.ChannelHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - io.netty.channel.ChannelHandler - - - All - private - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Spring - - - - - - - - - - - - - - - 1.8 - - - - - - - - MyNetty - - - - - - - - 1.8 - - - - - - - - Maven: aopalliance:aopalliance:1.0 - - - - - - - - \ No newline at end of file -- Gitee From 9b35c79cdeceab66ce48ab8ccbb2d3d2dcd4d516 Mon Sep 17 00:00:00 2001 From: diligence <15832183435@163.com> Date: Sun, 15 Dec 2019 23:35:33 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20ta?= =?UTF-8?q?rget?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- target/classes/config/NioDemoConfig.class | Bin 1546 -> 0 bytes target/classes/config/ZConfig.class | Bin 2329 -> 0 bytes target/classes/system.properties | 7 ------- target/classes/util/ClassLoaderUtil.class | Bin 868 -> 0 bytes target/classes/util/ConfigProperties.class | Bin 2437 -> 0 bytes target/classes/util/Dateutil.class | Bin 1127 -> 0 bytes target/classes/util/DeEnCode.class | Bin 1527 -> 0 bytes target/classes/util/FileLogger.class | Bin 1924 -> 0 bytes target/classes/util/FormatUtil.class | Bin 759 -> 0 bytes target/classes/util/IOUtil.class | Bin 3189 -> 0 bytes target/classes/util/JsonUtil.class | Bin 2051 -> 0 bytes target/classes/util/JvmUtil.class | Bin 863 -> 0 bytes target/classes/util/Logger.class | Bin 2268 -> 0 bytes target/classes/util/Print.class | Bin 1450 -> 0 bytes target/classes/util/RandomUtil.class | Bin 674 -> 0 bytes target/classes/util/ReflectionUtil.class | Bin 3030 -> 0 bytes target/test-classes/Test.class | Bin 567 -> 0 bytes 17 files changed, 7 deletions(-) delete mode 100644 target/classes/config/NioDemoConfig.class delete mode 100644 target/classes/config/ZConfig.class delete mode 100644 target/classes/system.properties delete mode 100644 target/classes/util/ClassLoaderUtil.class delete mode 100644 target/classes/util/ConfigProperties.class delete mode 100644 target/classes/util/Dateutil.class delete mode 100644 target/classes/util/DeEnCode.class delete mode 100644 target/classes/util/FileLogger.class delete mode 100644 target/classes/util/FormatUtil.class delete mode 100644 target/classes/util/IOUtil.class delete mode 100644 target/classes/util/JsonUtil.class delete mode 100644 target/classes/util/JvmUtil.class delete mode 100644 target/classes/util/Logger.class delete mode 100644 target/classes/util/Print.class delete mode 100644 target/classes/util/RandomUtil.class delete mode 100644 target/classes/util/ReflectionUtil.class delete mode 100644 target/test-classes/Test.class diff --git a/target/classes/config/NioDemoConfig.class b/target/classes/config/NioDemoConfig.class deleted file mode 100644 index 5fd46acc6a13144d4f2f7272af7c9afedad3ba22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1546 zcmZ`(+inwA6kR6?$%z>f<0LlsJ0T?0?!B}LP;kbL!8pd_m}{{n_DPs_?6GFXk;+S- z+W%=I5vi5(RVJsiCjKXxu>zHz{y=lUlyXli8RSKG}Uw1=~&wb%o{KAVA(xs-fIal_A zRnrdkn@(NSTb^&qZkzn|O4IM(J-Wa*C7hraHcf#nDEfeBmIq=XhtDlM#&w0+Ve!c; z7yTB+rk(A6n6HI%I8QU?i?dPK%y!-Qg@q@0YT*Jd(qKi?GEv-DU1Dikq@jrV7m1v)S9)GGR9I zUQ)DY_}RiDmZ;*$ggYc3P+w!s$0WqS>st7X!=*kXC-QC(#ul>dF*o!BQLy~LZ56_x zU69e}Z4=jBzeiJ=AGS1~?vcV_@+o%SyA9p7BF@uydzStj7Bmly*l`|_APq&3+Am0b z7NoukQWFKKV}jHiL288{l`cqy5{}SA%LIil=v0t1kXT&WgIe6f$X{afCB3I8CtwtOdKZ&S z6G9I&wS*pFIwf?PX;SD>rYWH_OlO78F-^ZhW*5hp9v6Co=}9p-#q_jD&u~2oT+b$s zNyZjtshT-t=s88Q3phbLdXiS;G})b@IxgY{E+LQ0Si?NZq;;@BU*8g*;~HADG9L9X Ypbp05@shgnJN4raLWS??juHIu4!OuvaR2}S diff --git a/target/classes/config/ZConfig.class b/target/classes/config/ZConfig.class deleted file mode 100644 index 22e13b822d8c6602559b4bcecaf95217e0109770..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2329 zcmb7FZFdtz6n>@+>^9xLkU|TB)S^P#(nJvz1W^bnMA9ZCp<2+^?RFBDrrEf=DKDb< z{s#It{0y8^JaUeH_cwXeXC|>pr5=x8_TG8!ojdp5dG73QfBgIlfTQ>!ia0JBD3~Zl z(S?%wTrw~h#dcim!6Ce@w08{5M-j#49$dk@3Vtt&1uU9)Uzu%%ESYeWTs9$63LP%<>pP;$-0btP{YxM|>)fT#-$XRq07cCrz= z)nwlH>e3Hg8JrO4o6cm@i^W1}F@L&rULe+VtlG6ovKabqtwN`M?Q}L>EVaCbHBd+w zbC(LK&g~5!qyDAEj-Xyz=||bPeTmg_6MblWxroPYHC#$L9nhDQ{T{3}oG!oNcTw zNxx(-Rf)v1o?}<%Y~NMu7AR=g)ohmQB{RA74M)~P*Q>E#k?^V;2n=Q&uU2*|$;&A% zY1!da?I6h8;nji+yoT>EN;2#Dm1Iy?%`W@)s=V&`D@n)mWs;Fo|J=YRy>6}E2zfoy zUfq;M8>UxZF|?hP8N04C)@&#k_>g>LhO4$)BQ4@rp1g0}3)`=-f}t(U0_I7l+Ui`i zsEe3(RiCU@oe9M?3&(I=VCsL>#$G3bn?Wd76ZH+2sz|pje1wk$c5X#u3*(rua0j0- zW9_i{Ml5`a;|4yn@HxJ)@FETy_|n2xxXmV&nR+7dokX3NV&Q9iV__19NqTKrmOy_};=xILcNA(qE&!!_C6W%F@n5JGgZVuc)xGjr=rT z_x#Ypt7=F8W+pR)?z4U-a!c2w6Lz+~O+&IXzBR-8D>BSPteBZx$F`Zr*gpRV#zUA7U>;sa&yO%?r`FMXpW6p1y%tAlVen+u`emm(Iqt6f$7{*EMAK^NJ*Kvvwm;m0uo0R=*#c7<;@kf!u zS*DvNK8&tE8Km35w1IO5&O;c;M9_n`aG_PqG5QMnMjya>fWCF~-{-1J=coSW;AuTP zPn~ZyJ(0x>S0-jRTJpR01n#ls*uXjlA7Y16V_F?j>Q1fhQtGf)N0ho-t9z9Clvewc zx>u|Fl=?K)pRj)&qYv?n0>(Ok0}6OnJ3pt?=R0f%RUJatv49ckyRnS~>BU}lcprPS zpV}xpH^yEc;B_D3s~G2~kF(YZc5@Qvh|aLf1wK&=I0A={ipS?8S?+{9w&*Q0Ya&bZ@6sGPkKs%(i|;D+D*@5J>i8DwcR z4fRf!%Zey>vX)B;k}y=MKy{)|erMAT&q> zc2rq!vqK}bi)u7+jb4?XhZZqx{U{~okX8%wdOy%4Zsn5NE>L^%`OhznZsz)$sPKNB aXNO95h_}0>)yr{p9;`6P$M@jfK<6(`Ho2n! diff --git a/target/classes/util/ConfigProperties.class b/target/classes/util/ConfigProperties.class deleted file mode 100644 index 6637f49be56ecb8155cdecd2634036244c1f758a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2437 zcmZ`)YgZFj6x}z8nPixNL=&X=p!k9SBGp<;(3YZTYIrD!Qrp@g8N%q0NhcHA{*(TK z`lTPrS_-VPR{OobsjKb2cZN(vx>(G8oOAX)k9|)5`sepQ09=QsqaXKED5Y@8w=7PCp31rJJ%va`wW7caE%f4sVYefM)Q1YoIkPkFkzU@pb zDPwt0t>m;_xBc4!@!^qGfyAs^C16k4u3HPOt#!*=G1ndSgj+G4RnxQOIlN5xn>NAw z$_jVZt#8=1chGag?|UYnNp0AU75HvAu34S)+^soYg_0%H-xLr$<^p@$ohU8d{jp*- zeA}(l?U-GEM_6yPd`51WTNG+GH&x3M7>LXxjYmpIz09(2R$k7V4Hb?`?m7#^a%iXs z7!oB6=O=+nN5%4fc+BKWi|WT-nNCXvRI~imVB5uQseW)eGB+iGLgzcPj@fJ$NB%d# zNmFSE^mcd>7zuPo40z1KlM?L|vT8jt@iXzgvEyg7Nq%PiJV2Xx7CteWY}R4P`p z*+ye7k5>*=pPc1`%Wli7SV3uXhY4~;vev*^oD+b74=_L<6q66})WB(+(NHyD;RgAp zbjS&bTZ#%Rp)LyaABa0dLCsl}mcKE6Qz~v4sA1E9jTZtZ+9nap47|iS0}gH&_!u`d zY#FGdXy7uYHMj;E_+DU8S*p%EIya>0k=?dR!L52@Wz%zi2s*M$ z!Il<-()N&BkF2IjchEiuJd(W=p%pud8IB6o_mT{JDP#a`!Y+|QqvE(t>tV~be22`= zM@q9&Al)fSy`Ba~58IGUwc?o-l3y}D>Y&~zV77r(lO39Bm|l}bWbi$a_<+^+Y~^37;S!F7clungk5P5M4Y;gu9|F<_m8S--EWW zkJQ@uF4EXmK@tbW^51LuW@Q&dbWyv%G2GcyHdc9gqGjNv0%j^Qe<(0&p(c`kCjgKH|Z z>vUT7^e_X8Q!9ZHTE}G|VYo5O5^GF_JA-lJ#E1wcC;l%taSc~BOlrgx8m>Lia9!4y zZ5mc#h58b&I~!B6kM5v%e(X2i1a<9J(%bxgPEWp2UJV8o?SyyZ6P55dx){L#Ed@Sp zzc9tKtaGwJ>}-Ubq!v)>C}FaVm<$mGrkIa_iMK+Ww8GiLiC^1J22e{KQ0X>QI)qBg zaYTqgT1^vDx|9&*(a0fP-96>^SqD;r1--3ais3VsQ7{p-pwvpAj`cwykBKy1zPJ+&?nwzK;Jk>WJ$D&4hEiZA07VaP=Fr~Y_wIxbFqi3;FS#%tRFAF3z zygvX7ukhNy8w+po&cX^-Ev(@^4e%P*>)66NHaOvfz}Pi$=J%wUv0ZGIvU>7aoL+FM-!CUKWeL%4_g6yf9&!ul?KiO@kRe2&QH+$Ew1 z=ZJM+Tp-@T(09UhIr+~46*j3tkJqI06dq{abe~rdZ3{R@L~=fwa3 diff --git a/target/classes/util/DeEnCode.class b/target/classes/util/DeEnCode.class deleted file mode 100644 index b795237727e0d5c74c370aac6c9b9832ada334f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1527 zcmcIj!EPH>6g_V|o*7RkO={}4apU6BP;AGE12HDVX`pcv2z8R8gb2uL>oEbD8 zBZVdEjui`jpc|HmRo5qAll*U1%Xf>H}J@?#m?>u<)!x4Zg z-ZwFV*Haim&A=Nbbj+GG-jvInj=J>Bo4A4n18P-ws_edf}LB=8{Esnb4STcLrsf z8$mB@JIkIda_C73Q&MmX=P+vFjHGe)An4`o(8-6MyBp<$z5K7=fBD=rt7Fx|8rChGMuvHx(T`#;FE!Rz3dPdp`PH?? zhaca#-js=MJOjVpy6LppZo_q=K}Xd>QT8-R(WMwCV%TQjx=u*%j??P70-3^7()B^= z^7Xlx`7u+&+4>|1*X(^NH1%}wU>1x2HE$ON0mtChNfsA5_appf63F5d(qQjsDL6@+ z+VE`34scKMjt$|OrB&fBq_=b*;yWG`oad_bofzZU8k}>uKr1DiM2`&q2`UWk^~9C) z3uC$4sNR7xr;e&ewPd2EWwcE4HnO8?Mw_YWrLof3Oh*6WtIb=Q_~!91w-l~F%an;Y zWtK_78d79GPR>)@tF-6HTGFVJ`8cb%h?n?bE11P4+6pPu@G?&cNd%YU8s+H~`UDE} zW}rTVD#Rn4(oq!RcjW#cSV~UX|5r&amTH`Qrzlw!IaV_M9FRJI7I62UiXDBFsjIImN+sKl)p^UlQG?VACF~Jh?`&` z)A4{A9HUoBQeo6dWf diff --git a/target/classes/util/FileLogger.class b/target/classes/util/FileLogger.class deleted file mode 100644 index be2bf133a640d678956f1dae23ac3b8060c84639..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1924 zcma)7TUQ!a7~KOSgE)%fB^r}9N!!#rZK_GDCQ(rvBZ>wTvDX0x97To~jVb+dlMx^L^)h*R#KUhF|~u>1P1bI1S+)ENWP4$6dri@L^fQ zN(gOO4dHXV5ZYQ0FNNEB5OJ~J2w@Wm4O<~}VLOOdVxQEI3L%0WvFwT^tzj>O0W69o zBeLxW@rBr|3-gy6zS8iu0+BF>G!wdtg-+^u%kfRgxLwcClzW%&S`Ef~}x` z#4A`b%Ef3RduZm|IZ;Pp%Kocf))FhHIkVzgcA23HQ%3$BrXW;c&uPbUO-DiZRkU}) zz^-hqP%s@c-}D*0@>#lJp>Jo>HF8HAMnztQC~5eHV z3^dI*dl%N6hP)0F1sz2k5HZGBC{XFtafk;Rj&zi8tf04abB! zpf~+QtD?kf9S*8GTyPq_tq zH!|8nv8!3>=MCPeGv}CudDA=*6e5G} z@_PpGDF{we^HV49xxU9;lv1H=8#{+`M#YEsxd!B62R@*#dk%Pr54mf{2u69rVC6nk zek6g65?3}Z;miC0zj_Weeu=is_&EX_6Bp3x2&N|@?NW@@5%TsOQq-Z-rSmNYHz(@| zd%8ZW3S~(B<%|VX%p=CnuaF5Ai{XWo32aO0mkqC?hqjN|{v&$Mpc{`dgeSb|r)>B$ zT4t%u$y^IqVV0*@#&hP1AeFs-q=qT%tnh9^M;S+$AvZ_Fn1MY=E0vwn$4hN$<($Lr|(9zlx!^d$x| z=eR|j1}`wgHFBFv9mB*ol9{0UkMI*_84{Apo%CA-*BKE$laty)l5lyjJmU0#KF+fr zVg4TtU=YJ>cm{W{Kx(X!5?h>XlJiXQ@_U@In7M!;fR_Yrmb)+(3Ee$rpJDVo&wTXu e00IFAdZGS-VGU0;Jo_EfOT52I_vbYEu<$p{Q>&i< diff --git a/target/classes/util/FormatUtil.class b/target/classes/util/FormatUtil.class deleted file mode 100644 index 88b892c9760e62dc146015c4041cddc54e898e83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 759 zcmaJ5O8{wU&|Z3$|l`*7#Zx#ylcb9R2-e)|Dn3mpp<=1nvvv0%Z#Vi`~HRAu+ZFXdFSG@a8+=r+@0U6OfR3N!dEhhS&nuIM*oyB z_n!vqAjwic=t_OK%Khk$o?+twY{Kk6=J7RGHanY|_1we@8!yqc(ZZUIHr8!yV4XGp zx)WhKmkUKaa6k0U178tp&EXMq@Ia+99&BqHot(;UoVg#9EbcSDmm6!od*gLa4)+Q5 zVdof!&8S=i>d&^uXwEoWPpdP3kAGv7Mct8&J8~cuds$@L?-=58oPi~j`L*cJ0BPGe zPVvs=m3W<4y8(U8%MUr0a?nJDb4_IerZK~78C5)DL^lf*SPoeH4&%65xIxitUt!`J xrS|+aOdTfMUzlJ(i#jXD5fpa7Of~cO{Qfa$;8P7!Mlhe zc)#NPu2r9ku2oQ6JiC1IFZc_5cX|8H%rtGGsAc8MnSJ)zdw+X>dk;VV^}}TV8}W^X z6dq7vXb9nf7=|_Eke4rJ9Y!!JcZXG28jj$oh60K)lr-2Vt9VeuTsSdQ=Dg3FQhI?3`DdmS!FiNB8e%G-|qaEw6773`1S?M*3o?|cg z={E#KnK9DKOzVQ`O};hDP7jtU)pFT(TrRF=Vw9N^u1VpD>2!3@YFAja)6EnP%c}v5D{him zJ;w2@SrUj2yJnFE3mwex-Vy%z)X7MTnUKy%p)f;LahE`BYpxJ5QtS7aBXJ7M@!7RO zl0nCMw2)?35+mbRgGQ=k--f*9s5qnJEZTHDj~7(DsN*GU((y80p~Y#WRq?8h*YG+E ztK$uM8XX+yYTc~jO&xFHoWL5-*?-VV$J;V6kyi1Jj(6pL!Q{PZHP*2X%_`p0@jgCa zUUoAdp&q&1k&%&psNy3XALA1ppW-tC==dC8ux?iZmWlXM#h8w-@b!%IzTqQg&Sjdt zD*?S{X!M_`uq;di$*|9{%ckR!tcp=Co29%!>;LN1Ami*C-x2fUm#eN~mJP>nZH}Lq zYx}J(urM_%q2g1(ItxaHe2`I1c9p>DYX>vcxvB)>HLsuZ;DiH@jm$6&tlDQ zx9LM>_CU)VS*|w@1{@>+s9d7_k67=e^%UDLd;VfHs=d6yF&DPRW*$xoS zXjb|)9LHc0BdK+=)naA4V##Ue4R_hE%#gR|VMFR*rn`F<*c?o8uQU89BS$(XJaaeo z*$`Nknw$(*qwBybe$!I?cnN5d>DTWU@wD2?)TRicg-we0!{%;^!mEeZW1>U+naZHY8QCJ=8O z=f$~5VhPuh{mMBt`ujhH18ZB5#jTOWs5pJY|rTlHit%yihK|m^{ThKwf zI`3^|Xd&8IfZMnWV;eOa5c-?uA}Y44xZPW~L#WuH5JRSh;imvYTcR#8@83WKiEN!p zpF|bMB6^yM>NaBAhI(x0X@=)r)aXPbc3~xU*HAT1L)8|biZKg5s(R+eM-|7KD^WFE z163z>G9+343Q@^=CPnj?h@5Z!9`gmpWW^`2;5?NS<}J?uV)@lr%6A~kwU6?Cp6tUs z?8ib3)W|T8`QJ&`C3Lc2Q^KldJ% z2RZzfU;7CxW+oF$d?t=dwT5e}HBM7oc5Sum0=2*oUsohn1~LZYgKcKN0f$Jv`&lG| z1k90ed6r-Vy*P|PSU8BIsG?W{PawF12?B4OL=W{sli>fr+Hg}7!S^v~UiL*Z6RA>n zsPV^GPiPx^W7TCYtMl!VWaI;)zJ5I19u2oENu}{qtY}HfhFmj{RNAB5x4jEx40Wdz zG4}VbmvF;SOE?)#=oip5zC~$Z-^PVxUdD4c$-E5f1w6r=KS}3Lv9c%G%%|8T&$4+> zlTBv`@+>FB^X#M-$*t40@ESvYoppYb^WvNbc0cR660311r3!z3=Sg-9krxAe%H1GO zI6(P4;7uBZXLnN`rr+JTho=#G-O4md3z8*^5&a8GRopAYpNI<4_&cIKY(~1fuQu^k e(y084aagVW4vXZ_6W+M+hhCX)hbRl-{(k_N+poYbPNf>5T3~6Qw^VKC@I8hZMUJ2DOTNM zv*xFx0N=$e@ zi^50<9T3abTyXYT^W5ENxlHMqe=f;0yt>RrP)L=WTEp@>En2vcFFy=HyCPTn6cZ3+ zeRjR+9=T;#T;MMB+oBL>&rV&eF1t^-R$(c;stXA%`VarsE|DBseF zayzZ6z2Qj54oXqdk9Vb63|z&8f%|x%5Z^6t%-uIo#;(FGzm@){^9<}^g5C0}?E+!K z`niFJ;6|liC3}rvU>q3@Ul`cO0}WpqI1uQyeuuHpaq5S5%fMIo+Q2vXmL*&`R~Np2 z-mS@+?e#lhUE}-{Hq_)X@cbiCZdp}&bM<0doP&7*jP;Wy9o+4aDal)Pr(#ts^QqPL zq!rA~($4m|qJgH>YTM_t^r6$18{@HeTwiZjttJno!qjxO?}gO$fEFdHE!*-ab>b4} zGH&n=9OLb&kQAFaN^s0==JPeqOuiN0@!T2IFC0WL*#!Y9T;tdX0C*j5aF)WGnCdS6 zndm5E>D+TfiZi3pQ^ZcTW>1k&CxpZ?z{PPwgfhbsND?Q3L5e|K#|Yl?KXILyLBtrj zK}r%bev|JwuHY8lCf9AwMxp-V(ujsT8m6H%WGN?y8Lp99PRJ1Bd-5f;{oH8u49Tt8 zndeAt&-tnbd{x4e=HEliS2amLK%N2ejF2gfS^70ce@tK5A~g)qJ5doKBEtMlsvYyy z&iQI5ahGWMP2wHAOSSVHXL|Sr-z3Q`b}Qi?@OHh2_lS#NiB<5-F(*|N7!eQjUt#1< zF<6{A@loQT?q}{%&yufBz9G@Ttt4lGTPZnhoC)7kzGah=Ia+aLYgX8T9SPX-bYP{o z3&i;x1aTBplOTgs9qH8-LbOP;G%dfm0cxctV|Z!lhBX#Whurx-cKDCg2` ZD%2VVEgh!WBiwXp+Hq!AiHYF-zX9mZw)Ox3 diff --git a/target/classes/util/JvmUtil.class b/target/classes/util/JvmUtil.class deleted file mode 100644 index 1241b4ba85d04cbbce01dd6b0de93b763a135b4e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 863 zcma)4%Wl&^6g`tTaj@Ma4W-cXE~QOUsG+a}Aq1#Wz-G#87T``V7X?(ObdL@T3yEX*3Y=0Uv~vX?Y``hkYK)ES@F}{az*v zbuZO2bf1r-L-G$8oIvQ8@yHiR(tDOu_Za5lRB0KBo!3tUR}8D(kdL_=auv7{S3D4r zP}+S}>>{qla2)kiqPgYGLW{t~Wf+>XVS9t2@HNBQEL9M`bF#xW_w^|LNLV_D zQ~MCM-TA-0SN=NWH#U<7Ob%t?6z|Eg6x2_043*?VC~1rJc0tG#(0TJ`j$wW#rKhwA zM9g50d6VN*KZDT&tkDC_z7pu}V3Tzya>+CDmF^d?&v|){Y&B1s zsMEhQX+Q%_ik2{s7G*MUpU6t&myc0;(fx`tgSXK#j!-FY9iw^#^AlA|$QbJ=lWoEv cw2iYl^CHy@EK;;UHJc`!qbL(}KF3}71tJa3wEzGB diff --git a/target/classes/util/Logger.class b/target/classes/util/Logger.class deleted file mode 100644 index 8c10146390e3541e1efcb778457df84a5cea6d4f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2268 zcmd5+T~ixX7=BK^b_q+13!%1RiM3z|q-iNtTUxA8Td4`fhHq%=5|*&AWMQ*$WTuz? z27iDv4%5qekuo~=(hL0u{uD>8&)H2XAzXRkNQSfLyyu+veV*ric7OTnhnE0GQH~>q z8*&(n<0fvY7+3L;g4=O?j0qWt0!q;-duG{d-Y$5qRW31a*r{@>qu?3E?Yyz;gHW(Y)K+=J;eK(0`#q_Z z*4%zsi>0S{+Hgxm&~?HwfwM>M28Ac8mc341lv}|F*_p2ExJ(6w>2zbnHV*!U|9eHTK~x9O7iJ=GTC2A3UnS1{e> z6Wegy9fK-fKWder!q^G@IkDmq2@Crb&t&yPfXs5TGxUzfgr>1Wa9zH7&0*SZS01v< z#~fRSA*~ZLc6ZG(0cTFY*$S#*nI;KmHwl6%I*L`-rO6xXW*vhlp(>PW+Ss9~di>e8 zDTSM~jY_4VUYJfi2C4CuwRENd3Gd)7eqQ8XjBcbwIiBY#%O?$rX!-@jb526&s~-Z| zkmOto4lu<9uG;V}F4ix9gDAp`T@g8v{tl!b z2sQsb+JqYND1v?ra1|ov_mColL8$ys zF_LDy4WU1vD;NqfIQ$ypuf!PP_Tq^ce?8bi-DnZ@5s;4IIlxZkxc WzMk7Y*x>8XS9i0(hfEg2^}hjggvXEo diff --git a/target/classes/util/Print.class b/target/classes/util/Print.class deleted file mode 100644 index 095571a0e4a2095e21b4ead6928f561cbe89ab06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1450 zcmah}?NZY~6g^8zlg98Bz62F2_|Z~B{Qy)zRH`Ui3Q|BF#~+~t8cY)=O`UPZf4+rp zp+5?vjt}6=_y&%5leA5N(f+u*d-v`+=bqj4*Pm}c0ZieQgh8a^xCT|iBr*c7ONb&Z z;RbH<*)0)Me4OTChS%KYdv`?Kl`xAr9_B^d5Y5^i&SneDH zvl;r6xqa=umN7MJFSEM6uNU1pj?buEIl0Bqwo9iXMINKBH_*auEiSmkutyBh5-~AI z1-t4L^(BJ~lsx)L&MM<9h6Fs8v4kfAp2}E8f?=?!$VXbN8s?7f2zVyrIdU>qkSB?= ze6lKIji;9JLdH6Blz$_jAY%iYGPbd0G=-tN$?dz* zk}7Fu9d0lUJs)+%^)0b+f9r1J;HT;*Ce+M+uEc{Vd&V? z-K=JsE4o{fo{>h8os$;`{aqhI#ShAU%%-S49$AcwSClMkEBjT zk3NvXP*4M4A`B_pZ5L{j>(;FG^X76zc>gP@2M2sK`VRKuC$*h8daIE0-D zuv577Z*2Mh*kgn}ek%6m2KFb?&3k+jh*mlX_XwReba8@iZ`H%63I*yR*K9D&)4dc< zYp;`lfizO|m$(GglQG~^HCi0O6<}GQQh@#+1z$o zZGq%=!|glMPyAlDVedQAM>cXUr>x6$3>e55(2+K+{&@Xq za%rY|RKKztfq>@OcY)~<4TTC}@xTgbEN0cOdFv$44+swCXd;!EP8f%nRrw0O@wFF- z2Lc6I#zaJ7nAqs!9P-Rk(k~hLd6V7pbLJ6B@fopKsOsfCi9wOvfJg?T7z;(lG0_*< zVYec=sbcdL@!~&$QYbJMHDNLokUok;JU^y>mst#Zfb=^O7cbDBpvaYYO2%j9OvV>Al|RU@v4f83A76N7U&7&QD{aHMl%+$ zC}c}2OtHD7A|sq!7D6k5?O0C0MoC3k#cK*;OD1EZHZy9aGS= z`Y=h~TiVhqm72?@g4kvCWron+i0>bZFH|i{8gvpNt6w$*=LQrJ$h7Sm&I0)`;GVt! z0nc)*KL{>G3YuNr5v&9U1)J9$QlObN*qq^tynFfa(n$ehRx8zf#;j1+7SIU^m5EBV zY&brAXJds{%C#zW-0ydMV1kEx0(kT_zLAx%>kZfmzYjEQ$%#77>SeDxR5&Us>_P=i zIdjq0-KxVPq}HWQuvwoy$+68guFg57Yb(<>o5U^Klqgo}sXgCVC2JpNxWjqD5 z+9n+byDGU+3q{K!eBQBjN|~WVu2gjj#-u4OX?x=p92UW7*oj>#Tn$xR(Qp;lRIF&Y zj$RF~qgO%b{IH5QG`xwoNVp!qyq`y^ro~V+yp4AhD5Dx~h(pRS`?=n$Q+j2IJ*43Y zysP3p4e#RvR$s%1_=t_5;bVNF;ZxjXi`PAP8PV_=KG*OCZff`vUkQjOReY@>jc*vy z29t%!t7FtE*HS0r-K5s~-oHNeGxJN1p>rO!6snHH(Nfzt&L=5lsl@H~TH6~(3cC9m z+O@8#PpWNoXY14wP!1?LceL7!klR3XvIb&AmMxPrU~jPb{Q-I(8Go$B^m5s-8RXDL zM*?lxP-aFOcS|*|%*VQ}6RlfM?P15!S2)^YdPQcrr!RQIze4`a^GfMYu1Lka&W7bj zXIh*t77tsNf-aw{XPGWp{^w+@|EymHG42X-nzlE5OuSYiH`Oh9oD}qJ$YcX{47rwn z1+BHEyr_awaBei-;lO37O#^RODaZ$t9y}EEFF6NFQ3H9X*@fNwmha$S1P}v1p4i1_ zH+Lg^D||->ZbA8(ix5qv5zvOmxYncr9>*T;n$Uw@|8R!ZAY7O}YBHqb^LF8yMwhA?K7x6Q< z(3DEuixlZEk!|9*$iDafAwj&L!`w=?=j zW(QZ%l^wi|M@J(=U6IsnY#WVsMMZ#NFThSjxjx6|1tf5hB=Zci-~}=vaTxj}ZHUO= ur|2b$tzK{;o=7qg$B5O&i!#F$M0h&Pq)gIE1ShVK)McqtaGbIb=Kck(pW<== diff --git a/target/test-classes/Test.class b/target/test-classes/Test.class deleted file mode 100644 index 8edc60125f26c14d72d59254aab642fe0bcf0c0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 567 zcmZuuOHaZ;5dM}|X{~@F_-*yqz%dRqB(R_&hrEhKENNKAih@-IYYd4~;fmmlAzCOl z8DeGc-eyRf!nLmly|(Q)c-tXl-t;W)G`TNiJO*RIqv(@{*|7UTiK=^CxD5Hio!RBj z+;F(tG3tRY+)gP}=YEIy*?-auTHPD?mR%LHohlWNq=*g$Nd@aVHn6E+OUE{L6zuBQ z!#=f?M25_y-%Yz~Thmber61Tm+R+c}&4~M^WqyPW_ -- Gitee From eab82a68e4966490f8906e0feecf795114f895a6 Mon Sep 17 00:00:00 2001 From: diligence <15832183435@163.com> Date: Sun, 15 Dec 2019 23:35:40 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20My?= =?UTF-8?q?Netty.iml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyNetty.iml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 MyNetty.iml diff --git a/MyNetty.iml b/MyNetty.iml deleted file mode 100644 index 78b2cc5..0000000 --- a/MyNetty.iml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file -- Gitee From c648cf6b466a0879393ef70884f7f72947db209a Mon Sep 17 00:00:00 2001 From: zhengpengfei <15832183435@163.com> Date: Mon, 16 Dec 2019 23:00:24 +0800 Subject: [PATCH 10/13] =?UTF-8?q?im=E8=81=8A=E5=A4=A9=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=BC=80=E5=8F=91=E4=BA=86...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat/pom.xml | 203 + chat/proto/protoConfig/ProtoMsg.proto | 77 + .../com/zpf/im/common/bean/msg/ProtoMsg.java | 6989 +++++++++++++++++ chatClient/pom.xml | 23 + .../src/main/java/client/CommandClient.java | 67 + .../src/main/java/command/BaseCommand.java | 11 + .../java/command/LoginConsoleCommand.java | 42 + chatServer/pom.xml | 32 + pom.xml | 6 + 9 files changed, 7450 insertions(+) create mode 100644 chat/pom.xml create mode 100644 chat/proto/protoConfig/ProtoMsg.proto create mode 100644 chat/src/main/java/com/zpf/im/common/bean/msg/ProtoMsg.java create mode 100644 chatClient/pom.xml create mode 100644 chatClient/src/main/java/client/CommandClient.java create mode 100644 chatClient/src/main/java/command/BaseCommand.java create mode 100644 chatClient/src/main/java/command/LoginConsoleCommand.java create mode 100644 chatServer/pom.xml diff --git a/chat/pom.xml b/chat/pom.xml new file mode 100644 index 0000000..67c4239 --- /dev/null +++ b/chat/pom.xml @@ -0,0 +1,203 @@ + + + + my_netty + com.zpf + 1.0-SNAPSHOT + + 4.0.0 + + chat + + + UTF-8 + 1.8 + 1.4.3.RELEASE + + + 4.0.33.Final + 3.6.1 + 1.8 + 1.8 + + 2.10.0 + 17.0 + 1.0 + 3.0.3 + 4.3.11.RELEASE + 1.2.29 + 4.1.0-incubating + + + + + + + + junit + junit + 4.11 + + + + org.springframework.boot + spring-boot-starter + ${springboot} + + + + + org.springframework.boot + spring-boot-starter-test + ${springboot} + + + + + org.springframework.boot + spring-boot-devtools + ${springboot} + true + + + + + + org.apache.zookeeper + zookeeper + 3.4.8 + + + + org.apache.curator + curator-client + 4.0.0 + + + org.apache.zookeeper + zookeeper + + + + + + org.apache.curator + curator-framework + 4.0.0 + + + org.apache.zookeeper + zookeeper + + + + + org.apache.curator + curator-recipes + 4.0.0 + + + + + redis.clients + jedis + 2.9.0 + + + + org.apache.commons + commons-pool2 + 2.6.0 + + + + org.springframework.data + spring-data-redis + ${springboot} + + + + io.netty + netty-all + ${netty.version} + + + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + + com.google.code.gson + gson + 2.3.1 + + + + commons-lang + commons-lang + 2.6 + + + + org.projectlombok + lombok + 1.16.10 + + + + + com.google.guava + guava + ${guava.version} + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.5.0 + true + + + ${project.basedir}/proto/protoConfig + + + ${project.build.sourceDirectory} + + false + + ${project.build.directory}/protoc-temp + + + ${project.basedir}/proto/protobin/protoc-3.6.0-win32/bin/protoc.exe + + + + + compile + test-compile + + + + + + + + + + \ No newline at end of file diff --git a/chat/proto/protoConfig/ProtoMsg.proto b/chat/proto/protoConfig/ProtoMsg.proto new file mode 100644 index 0000000..c0c3d1f --- /dev/null +++ b/chat/proto/protoConfig/ProtoMsg.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; +package com.zpf.im.common.bean.msg; + + +enum HeadType { + LOGIN_REQUEST = 0; + LOGIN_RESPONSE = 1; + LOGOUT_REQUEST = 2; + LOGOUT_RESPONSE = 3; + KEEPALIVE_REQUEST = 4; + KEEPALIVE_RESPONSE = 5; + MESSAGE_REQUEST = 6; + MESSAGE_RESPONSE = 7; + MESSAGE_NOTIFICATION = 8; +} + + +message LoginRequest { + string uid = 1; + string deviceId = 2; + string token = 3; + uint32 platform = 4; + string app_version = 5; +} + +message LoginResponse { + bool result = 1; + uint32 code = 2; + string info = 3; + uint32 expose = 4; +} + + +message MessageRequest { + uint64 msg_id = 1; + string from = 2; + string to = 3; + uint64 time = 4; + uint32 msg_type = 5; + string content = 6; + string url = 8; + string property = 9; + string from_nick = 10; + string json = 11; +} + + +message MessageResponse { + bool result = 1; + uint32 code = 2; + string info = 3; + uint32 expose = 4; + bool last_block = 5; + fixed32 block_index = 6; +} + + +message MessageNotification { + uint32 msg_type = 1; + bytes sender = 2; + string json = 3; + string timestamp = 4; +} + + +message Message { + HeadType type = 1; + uint64 sequence = 2; + string session_id = 3; + LoginRequest loginRequest = 4; + LoginResponse loginResponse = 5; + MessageRequest messageRequest = 6; + MessageResponse messageResponse = 7; + MessageNotification notification = 8; +} + + diff --git a/chat/src/main/java/com/zpf/im/common/bean/msg/ProtoMsg.java b/chat/src/main/java/com/zpf/im/common/bean/msg/ProtoMsg.java new file mode 100644 index 0000000..e2e2f91 --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/bean/msg/ProtoMsg.java @@ -0,0 +1,6989 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ProtoMsg.proto + +package com.zpf.im.common.bean.msg; + +public final class ProtoMsg { + private ProtoMsg() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + /** + * Protobuf enum {@code com.zpf.im.common.bean.msg.HeadType} + */ + public enum HeadType + implements com.google.protobuf.ProtocolMessageEnum { + /** + * LOGIN_REQUEST = 0; + */ + LOGIN_REQUEST(0), + /** + * LOGIN_RESPONSE = 1; + */ + LOGIN_RESPONSE(1), + /** + * LOGOUT_REQUEST = 2; + */ + LOGOUT_REQUEST(2), + /** + * LOGOUT_RESPONSE = 3; + */ + LOGOUT_RESPONSE(3), + /** + * KEEPALIVE_REQUEST = 4; + */ + KEEPALIVE_REQUEST(4), + /** + * KEEPALIVE_RESPONSE = 5; + */ + KEEPALIVE_RESPONSE(5), + /** + * MESSAGE_REQUEST = 6; + */ + MESSAGE_REQUEST(6), + /** + * MESSAGE_RESPONSE = 7; + */ + MESSAGE_RESPONSE(7), + /** + * MESSAGE_NOTIFICATION = 8; + */ + MESSAGE_NOTIFICATION(8), + UNRECOGNIZED(-1), + ; + + /** + * LOGIN_REQUEST = 0; + */ + public static final int LOGIN_REQUEST_VALUE = 0; + /** + * LOGIN_RESPONSE = 1; + */ + public static final int LOGIN_RESPONSE_VALUE = 1; + /** + * LOGOUT_REQUEST = 2; + */ + public static final int LOGOUT_REQUEST_VALUE = 2; + /** + * LOGOUT_RESPONSE = 3; + */ + public static final int LOGOUT_RESPONSE_VALUE = 3; + /** + * KEEPALIVE_REQUEST = 4; + */ + public static final int KEEPALIVE_REQUEST_VALUE = 4; + /** + * KEEPALIVE_RESPONSE = 5; + */ + public static final int KEEPALIVE_RESPONSE_VALUE = 5; + /** + * MESSAGE_REQUEST = 6; + */ + public static final int MESSAGE_REQUEST_VALUE = 6; + /** + * MESSAGE_RESPONSE = 7; + */ + public static final int MESSAGE_RESPONSE_VALUE = 7; + /** + * MESSAGE_NOTIFICATION = 8; + */ + public static final int MESSAGE_NOTIFICATION_VALUE = 8; + + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static HeadType valueOf(int value) { + return forNumber(value); + } + + public static HeadType forNumber(int value) { + switch (value) { + case 0: return LOGIN_REQUEST; + case 1: return LOGIN_RESPONSE; + case 2: return LOGOUT_REQUEST; + case 3: return LOGOUT_RESPONSE; + case 4: return KEEPALIVE_REQUEST; + case 5: return KEEPALIVE_RESPONSE; + case 6: return MESSAGE_REQUEST; + case 7: return MESSAGE_RESPONSE; + case 8: return MESSAGE_NOTIFICATION; + default: return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + private static final com.google.protobuf.Internal.EnumLiteMap< + HeadType> internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public HeadType findValueByNumber(int number) { + return HeadType.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor + getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + public final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptorForType() { + return getDescriptor(); + } + public static final com.google.protobuf.Descriptors.EnumDescriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.getDescriptor().getEnumTypes().get(0); + } + + private static final HeadType[] VALUES = values(); + + public static HeadType valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException( + "EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private HeadType(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:com.zpf.im.common.bean.msg.HeadType) + } + + public interface LoginRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.zpf.im.common.bean.msg.LoginRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * string uid = 1; + */ + java.lang.String getUid(); + /** + * string uid = 1; + */ + com.google.protobuf.ByteString + getUidBytes(); + + /** + * string deviceId = 2; + */ + java.lang.String getDeviceId(); + /** + * string deviceId = 2; + */ + com.google.protobuf.ByteString + getDeviceIdBytes(); + + /** + * string token = 3; + */ + java.lang.String getToken(); + /** + * string token = 3; + */ + com.google.protobuf.ByteString + getTokenBytes(); + + /** + * uint32 platform = 4; + */ + int getPlatform(); + + /** + * string app_version = 5; + */ + java.lang.String getAppVersion(); + /** + * string app_version = 5; + */ + com.google.protobuf.ByteString + getAppVersionBytes(); + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.LoginRequest} + */ + public static final class LoginRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.zpf.im.common.bean.msg.LoginRequest) + LoginRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use LoginRequest.newBuilder() to construct. + private LoginRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LoginRequest() { + uid_ = ""; + deviceId_ = ""; + token_ = ""; + platform_ = 0; + appVersion_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private LoginRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + java.lang.String s = input.readStringRequireUtf8(); + + uid_ = s; + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + deviceId_ = s; + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + token_ = s; + break; + } + case 32: { + + platform_ = input.readUInt32(); + break; + } + case 42: { + java.lang.String s = input.readStringRequireUtf8(); + + appVersion_ = s; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.class, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder.class); + } + + public static final int UID_FIELD_NUMBER = 1; + private volatile java.lang.Object uid_; + /** + * string uid = 1; + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * string uid = 1; + */ + public com.google.protobuf.ByteString + getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DEVICEID_FIELD_NUMBER = 2; + private volatile java.lang.Object deviceId_; + /** + * string deviceId = 2; + */ + public java.lang.String getDeviceId() { + java.lang.Object ref = deviceId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + deviceId_ = s; + return s; + } + } + /** + * string deviceId = 2; + */ + public com.google.protobuf.ByteString + getDeviceIdBytes() { + java.lang.Object ref = deviceId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + deviceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object token_; + /** + * string token = 3; + */ + public java.lang.String getToken() { + java.lang.Object ref = token_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + token_ = s; + return s; + } + } + /** + * string token = 3; + */ + public com.google.protobuf.ByteString + getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PLATFORM_FIELD_NUMBER = 4; + private int platform_; + /** + * uint32 platform = 4; + */ + public int getPlatform() { + return platform_; + } + + public static final int APP_VERSION_FIELD_NUMBER = 5; + private volatile java.lang.Object appVersion_; + /** + * string app_version = 5; + */ + public java.lang.String getAppVersion() { + java.lang.Object ref = appVersion_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + appVersion_ = s; + return s; + } + } + /** + * string app_version = 5; + */ + public com.google.protobuf.ByteString + getAppVersionBytes() { + java.lang.Object ref = appVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + appVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (!getUidBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, uid_); + } + if (!getDeviceIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, deviceId_); + } + if (!getTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, token_); + } + if (platform_ != 0) { + output.writeUInt32(4, platform_); + } + if (!getAppVersionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, appVersion_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUidBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, uid_); + } + if (!getDeviceIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, deviceId_); + } + if (!getTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, token_); + } + if (platform_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, platform_); + } + if (!getAppVersionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, appVersion_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest)) { + return super.equals(obj); + } + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest other = (com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest) obj; + + boolean result = true; + result = result && getUid() + .equals(other.getUid()); + result = result && getDeviceId() + .equals(other.getDeviceId()); + result = result && getToken() + .equals(other.getToken()); + result = result && (getPlatform() + == other.getPlatform()); + result = result && getAppVersion() + .equals(other.getAppVersion()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + DEVICEID_FIELD_NUMBER; + hash = (53 * hash) + getDeviceId().hashCode(); + hash = (37 * hash) + TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getToken().hashCode(); + hash = (37 * hash) + PLATFORM_FIELD_NUMBER; + hash = (53 * hash) + getPlatform(); + hash = (37 * hash) + APP_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getAppVersion().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.LoginRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.zpf.im.common.bean.msg.LoginRequest) + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.class, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder.class); + } + + // Construct using com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + uid_ = ""; + + deviceId_ = ""; + + token_ = ""; + + platform_ = 0; + + appVersion_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginRequest_descriptor; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest getDefaultInstanceForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest build() { + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest buildPartial() { + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest result = new com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest(this); + result.uid_ = uid_; + result.deviceId_ = deviceId_; + result.token_ = token_; + result.platform_ = platform_; + result.appVersion_ = appVersion_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest) { + return mergeFrom((com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest other) { + if (other == com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.getDefaultInstance()) return this; + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (!other.getDeviceId().isEmpty()) { + deviceId_ = other.deviceId_; + onChanged(); + } + if (!other.getToken().isEmpty()) { + token_ = other.token_; + onChanged(); + } + if (other.getPlatform() != 0) { + setPlatform(other.getPlatform()); + } + if (!other.getAppVersion().isEmpty()) { + appVersion_ = other.appVersion_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object uid_ = ""; + /** + * string uid = 1; + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string uid = 1; + */ + public com.google.protobuf.ByteString + getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string uid = 1; + */ + public Builder setUid( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * string uid = 1; + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * string uid = 1; + */ + public Builder setUidBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private java.lang.Object deviceId_ = ""; + /** + * string deviceId = 2; + */ + public java.lang.String getDeviceId() { + java.lang.Object ref = deviceId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + deviceId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string deviceId = 2; + */ + public com.google.protobuf.ByteString + getDeviceIdBytes() { + java.lang.Object ref = deviceId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + deviceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string deviceId = 2; + */ + public Builder setDeviceId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + deviceId_ = value; + onChanged(); + return this; + } + /** + * string deviceId = 2; + */ + public Builder clearDeviceId() { + + deviceId_ = getDefaultInstance().getDeviceId(); + onChanged(); + return this; + } + /** + * string deviceId = 2; + */ + public Builder setDeviceIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + deviceId_ = value; + onChanged(); + return this; + } + + private java.lang.Object token_ = ""; + /** + * string token = 3; + */ + public java.lang.String getToken() { + java.lang.Object ref = token_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + token_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string token = 3; + */ + public com.google.protobuf.ByteString + getTokenBytes() { + java.lang.Object ref = token_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + token_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string token = 3; + */ + public Builder setToken( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + token_ = value; + onChanged(); + return this; + } + /** + * string token = 3; + */ + public Builder clearToken() { + + token_ = getDefaultInstance().getToken(); + onChanged(); + return this; + } + /** + * string token = 3; + */ + public Builder setTokenBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + token_ = value; + onChanged(); + return this; + } + + private int platform_ ; + /** + * uint32 platform = 4; + */ + public int getPlatform() { + return platform_; + } + /** + * uint32 platform = 4; + */ + public Builder setPlatform(int value) { + + platform_ = value; + onChanged(); + return this; + } + /** + * uint32 platform = 4; + */ + public Builder clearPlatform() { + + platform_ = 0; + onChanged(); + return this; + } + + private java.lang.Object appVersion_ = ""; + /** + * string app_version = 5; + */ + public java.lang.String getAppVersion() { + java.lang.Object ref = appVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + appVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string app_version = 5; + */ + public com.google.protobuf.ByteString + getAppVersionBytes() { + java.lang.Object ref = appVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + appVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string app_version = 5; + */ + public Builder setAppVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + appVersion_ = value; + onChanged(); + return this; + } + /** + * string app_version = 5; + */ + public Builder clearAppVersion() { + + appVersion_ = getDefaultInstance().getAppVersion(); + onChanged(); + return this; + } + /** + * string app_version = 5; + */ + public Builder setAppVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + appVersion_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.zpf.im.common.bean.msg.LoginRequest) + } + + // @@protoc_insertion_point(class_scope:com.zpf.im.common.bean.msg.LoginRequest) + private static final com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest(); + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LoginRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LoginRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface LoginResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.zpf.im.common.bean.msg.LoginResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * bool result = 1; + */ + boolean getResult(); + + /** + * uint32 code = 2; + */ + int getCode(); + + /** + * string info = 3; + */ + java.lang.String getInfo(); + /** + * string info = 3; + */ + com.google.protobuf.ByteString + getInfoBytes(); + + /** + * uint32 expose = 4; + */ + int getExpose(); + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.LoginResponse} + */ + public static final class LoginResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.zpf.im.common.bean.msg.LoginResponse) + LoginResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use LoginResponse.newBuilder() to construct. + private LoginResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private LoginResponse() { + result_ = false; + code_ = 0; + info_ = ""; + expose_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private LoginResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + result_ = input.readBool(); + break; + } + case 16: { + + code_ = input.readUInt32(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + info_ = s; + break; + } + case 32: { + + expose_ = input.readUInt32(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.class, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder.class); + } + + public static final int RESULT_FIELD_NUMBER = 1; + private boolean result_; + /** + * bool result = 1; + */ + public boolean getResult() { + return result_; + } + + public static final int CODE_FIELD_NUMBER = 2; + private int code_; + /** + * uint32 code = 2; + */ + public int getCode() { + return code_; + } + + public static final int INFO_FIELD_NUMBER = 3; + private volatile java.lang.Object info_; + /** + * string info = 3; + */ + public java.lang.String getInfo() { + java.lang.Object ref = info_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + info_ = s; + return s; + } + } + /** + * string info = 3; + */ + public com.google.protobuf.ByteString + getInfoBytes() { + java.lang.Object ref = info_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + info_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXPOSE_FIELD_NUMBER = 4; + private int expose_; + /** + * uint32 expose = 4; + */ + public int getExpose() { + return expose_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (result_ != false) { + output.writeBool(1, result_); + } + if (code_ != 0) { + output.writeUInt32(2, code_); + } + if (!getInfoBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, info_); + } + if (expose_ != 0) { + output.writeUInt32(4, expose_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (result_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, result_); + } + if (code_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, code_); + } + if (!getInfoBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, info_); + } + if (expose_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, expose_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse)) { + return super.equals(obj); + } + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse other = (com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse) obj; + + boolean result = true; + result = result && (getResult() + == other.getResult()); + result = result && (getCode() + == other.getCode()); + result = result && getInfo() + .equals(other.getInfo()); + result = result && (getExpose() + == other.getExpose()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RESULT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getResult()); + hash = (37 * hash) + CODE_FIELD_NUMBER; + hash = (53 * hash) + getCode(); + hash = (37 * hash) + INFO_FIELD_NUMBER; + hash = (53 * hash) + getInfo().hashCode(); + hash = (37 * hash) + EXPOSE_FIELD_NUMBER; + hash = (53 * hash) + getExpose(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.LoginResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.zpf.im.common.bean.msg.LoginResponse) + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.class, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder.class); + } + + // Construct using com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + result_ = false; + + code_ = 0; + + info_ = ""; + + expose_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_LoginResponse_descriptor; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse getDefaultInstanceForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse build() { + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse buildPartial() { + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse result = new com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse(this); + result.result_ = result_; + result.code_ = code_; + result.info_ = info_; + result.expose_ = expose_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse) { + return mergeFrom((com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse other) { + if (other == com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.getDefaultInstance()) return this; + if (other.getResult() != false) { + setResult(other.getResult()); + } + if (other.getCode() != 0) { + setCode(other.getCode()); + } + if (!other.getInfo().isEmpty()) { + info_ = other.info_; + onChanged(); + } + if (other.getExpose() != 0) { + setExpose(other.getExpose()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean result_ ; + /** + * bool result = 1; + */ + public boolean getResult() { + return result_; + } + /** + * bool result = 1; + */ + public Builder setResult(boolean value) { + + result_ = value; + onChanged(); + return this; + } + /** + * bool result = 1; + */ + public Builder clearResult() { + + result_ = false; + onChanged(); + return this; + } + + private int code_ ; + /** + * uint32 code = 2; + */ + public int getCode() { + return code_; + } + /** + * uint32 code = 2; + */ + public Builder setCode(int value) { + + code_ = value; + onChanged(); + return this; + } + /** + * uint32 code = 2; + */ + public Builder clearCode() { + + code_ = 0; + onChanged(); + return this; + } + + private java.lang.Object info_ = ""; + /** + * string info = 3; + */ + public java.lang.String getInfo() { + java.lang.Object ref = info_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + info_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string info = 3; + */ + public com.google.protobuf.ByteString + getInfoBytes() { + java.lang.Object ref = info_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + info_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string info = 3; + */ + public Builder setInfo( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + info_ = value; + onChanged(); + return this; + } + /** + * string info = 3; + */ + public Builder clearInfo() { + + info_ = getDefaultInstance().getInfo(); + onChanged(); + return this; + } + /** + * string info = 3; + */ + public Builder setInfoBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + info_ = value; + onChanged(); + return this; + } + + private int expose_ ; + /** + * uint32 expose = 4; + */ + public int getExpose() { + return expose_; + } + /** + * uint32 expose = 4; + */ + public Builder setExpose(int value) { + + expose_ = value; + onChanged(); + return this; + } + /** + * uint32 expose = 4; + */ + public Builder clearExpose() { + + expose_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.zpf.im.common.bean.msg.LoginResponse) + } + + // @@protoc_insertion_point(class_scope:com.zpf.im.common.bean.msg.LoginResponse) + private static final com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse(); + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LoginResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LoginResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface MessageRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.zpf.im.common.bean.msg.MessageRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * uint64 msg_id = 1; + */ + long getMsgId(); + + /** + * string from = 2; + */ + java.lang.String getFrom(); + /** + * string from = 2; + */ + com.google.protobuf.ByteString + getFromBytes(); + + /** + * string to = 3; + */ + java.lang.String getTo(); + /** + * string to = 3; + */ + com.google.protobuf.ByteString + getToBytes(); + + /** + * uint64 time = 4; + */ + long getTime(); + + /** + * uint32 msg_type = 5; + */ + int getMsgType(); + + /** + * string content = 6; + */ + java.lang.String getContent(); + /** + * string content = 6; + */ + com.google.protobuf.ByteString + getContentBytes(); + + /** + * string url = 8; + */ + java.lang.String getUrl(); + /** + * string url = 8; + */ + com.google.protobuf.ByteString + getUrlBytes(); + + /** + * string property = 9; + */ + java.lang.String getProperty(); + /** + * string property = 9; + */ + com.google.protobuf.ByteString + getPropertyBytes(); + + /** + * string from_nick = 10; + */ + java.lang.String getFromNick(); + /** + * string from_nick = 10; + */ + com.google.protobuf.ByteString + getFromNickBytes(); + + /** + * string json = 11; + */ + java.lang.String getJson(); + /** + * string json = 11; + */ + com.google.protobuf.ByteString + getJsonBytes(); + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.MessageRequest} + */ + public static final class MessageRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.zpf.im.common.bean.msg.MessageRequest) + MessageRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use MessageRequest.newBuilder() to construct. + private MessageRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MessageRequest() { + msgId_ = 0L; + from_ = ""; + to_ = ""; + time_ = 0L; + msgType_ = 0; + content_ = ""; + url_ = ""; + property_ = ""; + fromNick_ = ""; + json_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MessageRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + msgId_ = input.readUInt64(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + from_ = s; + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + to_ = s; + break; + } + case 32: { + + time_ = input.readUInt64(); + break; + } + case 40: { + + msgType_ = input.readUInt32(); + break; + } + case 50: { + java.lang.String s = input.readStringRequireUtf8(); + + content_ = s; + break; + } + case 66: { + java.lang.String s = input.readStringRequireUtf8(); + + url_ = s; + break; + } + case 74: { + java.lang.String s = input.readStringRequireUtf8(); + + property_ = s; + break; + } + case 82: { + java.lang.String s = input.readStringRequireUtf8(); + + fromNick_ = s; + break; + } + case 90: { + java.lang.String s = input.readStringRequireUtf8(); + + json_ = s; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.class, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder.class); + } + + public static final int MSG_ID_FIELD_NUMBER = 1; + private long msgId_; + /** + * uint64 msg_id = 1; + */ + public long getMsgId() { + return msgId_; + } + + public static final int FROM_FIELD_NUMBER = 2; + private volatile java.lang.Object from_; + /** + * string from = 2; + */ + public java.lang.String getFrom() { + java.lang.Object ref = from_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + from_ = s; + return s; + } + } + /** + * string from = 2; + */ + public com.google.protobuf.ByteString + getFromBytes() { + java.lang.Object ref = from_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + from_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TO_FIELD_NUMBER = 3; + private volatile java.lang.Object to_; + /** + * string to = 3; + */ + public java.lang.String getTo() { + java.lang.Object ref = to_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + to_ = s; + return s; + } + } + /** + * string to = 3; + */ + public com.google.protobuf.ByteString + getToBytes() { + java.lang.Object ref = to_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + to_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TIME_FIELD_NUMBER = 4; + private long time_; + /** + * uint64 time = 4; + */ + public long getTime() { + return time_; + } + + public static final int MSG_TYPE_FIELD_NUMBER = 5; + private int msgType_; + /** + * uint32 msg_type = 5; + */ + public int getMsgType() { + return msgType_; + } + + public static final int CONTENT_FIELD_NUMBER = 6; + private volatile java.lang.Object content_; + /** + * string content = 6; + */ + public java.lang.String getContent() { + java.lang.Object ref = content_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + content_ = s; + return s; + } + } + /** + * string content = 6; + */ + public com.google.protobuf.ByteString + getContentBytes() { + java.lang.Object ref = content_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + content_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int URL_FIELD_NUMBER = 8; + private volatile java.lang.Object url_; + /** + * string url = 8; + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } + } + /** + * string url = 8; + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PROPERTY_FIELD_NUMBER = 9; + private volatile java.lang.Object property_; + /** + * string property = 9; + */ + public java.lang.String getProperty() { + java.lang.Object ref = property_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + property_ = s; + return s; + } + } + /** + * string property = 9; + */ + public com.google.protobuf.ByteString + getPropertyBytes() { + java.lang.Object ref = property_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + property_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FROM_NICK_FIELD_NUMBER = 10; + private volatile java.lang.Object fromNick_; + /** + * string from_nick = 10; + */ + public java.lang.String getFromNick() { + java.lang.Object ref = fromNick_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + fromNick_ = s; + return s; + } + } + /** + * string from_nick = 10; + */ + public com.google.protobuf.ByteString + getFromNickBytes() { + java.lang.Object ref = fromNick_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + fromNick_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int JSON_FIELD_NUMBER = 11; + private volatile java.lang.Object json_; + /** + * string json = 11; + */ + public java.lang.String getJson() { + java.lang.Object ref = json_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + json_ = s; + return s; + } + } + /** + * string json = 11; + */ + public com.google.protobuf.ByteString + getJsonBytes() { + java.lang.Object ref = json_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + json_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (msgId_ != 0L) { + output.writeUInt64(1, msgId_); + } + if (!getFromBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, from_); + } + if (!getToBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, to_); + } + if (time_ != 0L) { + output.writeUInt64(4, time_); + } + if (msgType_ != 0) { + output.writeUInt32(5, msgType_); + } + if (!getContentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, content_); + } + if (!getUrlBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 8, url_); + } + if (!getPropertyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 9, property_); + } + if (!getFromNickBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 10, fromNick_); + } + if (!getJsonBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, json_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (msgId_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(1, msgId_); + } + if (!getFromBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, from_); + } + if (!getToBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, to_); + } + if (time_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(4, time_); + } + if (msgType_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(5, msgType_); + } + if (!getContentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, content_); + } + if (!getUrlBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(8, url_); + } + if (!getPropertyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, property_); + } + if (!getFromNickBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, fromNick_); + } + if (!getJsonBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, json_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest)) { + return super.equals(obj); + } + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest other = (com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest) obj; + + boolean result = true; + result = result && (getMsgId() + == other.getMsgId()); + result = result && getFrom() + .equals(other.getFrom()); + result = result && getTo() + .equals(other.getTo()); + result = result && (getTime() + == other.getTime()); + result = result && (getMsgType() + == other.getMsgType()); + result = result && getContent() + .equals(other.getContent()); + result = result && getUrl() + .equals(other.getUrl()); + result = result && getProperty() + .equals(other.getProperty()); + result = result && getFromNick() + .equals(other.getFromNick()); + result = result && getJson() + .equals(other.getJson()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MSG_ID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getMsgId()); + hash = (37 * hash) + FROM_FIELD_NUMBER; + hash = (53 * hash) + getFrom().hashCode(); + hash = (37 * hash) + TO_FIELD_NUMBER; + hash = (53 * hash) + getTo().hashCode(); + hash = (37 * hash) + TIME_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getTime()); + hash = (37 * hash) + MSG_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMsgType(); + hash = (37 * hash) + CONTENT_FIELD_NUMBER; + hash = (53 * hash) + getContent().hashCode(); + hash = (37 * hash) + URL_FIELD_NUMBER; + hash = (53 * hash) + getUrl().hashCode(); + hash = (37 * hash) + PROPERTY_FIELD_NUMBER; + hash = (53 * hash) + getProperty().hashCode(); + hash = (37 * hash) + FROM_NICK_FIELD_NUMBER; + hash = (53 * hash) + getFromNick().hashCode(); + hash = (37 * hash) + JSON_FIELD_NUMBER; + hash = (53 * hash) + getJson().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.MessageRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.zpf.im.common.bean.msg.MessageRequest) + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.class, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder.class); + } + + // Construct using com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + msgId_ = 0L; + + from_ = ""; + + to_ = ""; + + time_ = 0L; + + msgType_ = 0; + + content_ = ""; + + url_ = ""; + + property_ = ""; + + fromNick_ = ""; + + json_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageRequest_descriptor; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest getDefaultInstanceForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest build() { + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest buildPartial() { + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest result = new com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest(this); + result.msgId_ = msgId_; + result.from_ = from_; + result.to_ = to_; + result.time_ = time_; + result.msgType_ = msgType_; + result.content_ = content_; + result.url_ = url_; + result.property_ = property_; + result.fromNick_ = fromNick_; + result.json_ = json_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest) { + return mergeFrom((com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest other) { + if (other == com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.getDefaultInstance()) return this; + if (other.getMsgId() != 0L) { + setMsgId(other.getMsgId()); + } + if (!other.getFrom().isEmpty()) { + from_ = other.from_; + onChanged(); + } + if (!other.getTo().isEmpty()) { + to_ = other.to_; + onChanged(); + } + if (other.getTime() != 0L) { + setTime(other.getTime()); + } + if (other.getMsgType() != 0) { + setMsgType(other.getMsgType()); + } + if (!other.getContent().isEmpty()) { + content_ = other.content_; + onChanged(); + } + if (!other.getUrl().isEmpty()) { + url_ = other.url_; + onChanged(); + } + if (!other.getProperty().isEmpty()) { + property_ = other.property_; + onChanged(); + } + if (!other.getFromNick().isEmpty()) { + fromNick_ = other.fromNick_; + onChanged(); + } + if (!other.getJson().isEmpty()) { + json_ = other.json_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long msgId_ ; + /** + * uint64 msg_id = 1; + */ + public long getMsgId() { + return msgId_; + } + /** + * uint64 msg_id = 1; + */ + public Builder setMsgId(long value) { + + msgId_ = value; + onChanged(); + return this; + } + /** + * uint64 msg_id = 1; + */ + public Builder clearMsgId() { + + msgId_ = 0L; + onChanged(); + return this; + } + + private java.lang.Object from_ = ""; + /** + * string from = 2; + */ + public java.lang.String getFrom() { + java.lang.Object ref = from_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + from_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string from = 2; + */ + public com.google.protobuf.ByteString + getFromBytes() { + java.lang.Object ref = from_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + from_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string from = 2; + */ + public Builder setFrom( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + from_ = value; + onChanged(); + return this; + } + /** + * string from = 2; + */ + public Builder clearFrom() { + + from_ = getDefaultInstance().getFrom(); + onChanged(); + return this; + } + /** + * string from = 2; + */ + public Builder setFromBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + from_ = value; + onChanged(); + return this; + } + + private java.lang.Object to_ = ""; + /** + * string to = 3; + */ + public java.lang.String getTo() { + java.lang.Object ref = to_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + to_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string to = 3; + */ + public com.google.protobuf.ByteString + getToBytes() { + java.lang.Object ref = to_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + to_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string to = 3; + */ + public Builder setTo( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + to_ = value; + onChanged(); + return this; + } + /** + * string to = 3; + */ + public Builder clearTo() { + + to_ = getDefaultInstance().getTo(); + onChanged(); + return this; + } + /** + * string to = 3; + */ + public Builder setToBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + to_ = value; + onChanged(); + return this; + } + + private long time_ ; + /** + * uint64 time = 4; + */ + public long getTime() { + return time_; + } + /** + * uint64 time = 4; + */ + public Builder setTime(long value) { + + time_ = value; + onChanged(); + return this; + } + /** + * uint64 time = 4; + */ + public Builder clearTime() { + + time_ = 0L; + onChanged(); + return this; + } + + private int msgType_ ; + /** + * uint32 msg_type = 5; + */ + public int getMsgType() { + return msgType_; + } + /** + * uint32 msg_type = 5; + */ + public Builder setMsgType(int value) { + + msgType_ = value; + onChanged(); + return this; + } + /** + * uint32 msg_type = 5; + */ + public Builder clearMsgType() { + + msgType_ = 0; + onChanged(); + return this; + } + + private java.lang.Object content_ = ""; + /** + * string content = 6; + */ + public java.lang.String getContent() { + java.lang.Object ref = content_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + content_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string content = 6; + */ + public com.google.protobuf.ByteString + getContentBytes() { + java.lang.Object ref = content_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + content_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string content = 6; + */ + public Builder setContent( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + content_ = value; + onChanged(); + return this; + } + /** + * string content = 6; + */ + public Builder clearContent() { + + content_ = getDefaultInstance().getContent(); + onChanged(); + return this; + } + /** + * string content = 6; + */ + public Builder setContentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + content_ = value; + onChanged(); + return this; + } + + private java.lang.Object url_ = ""; + /** + * string url = 8; + */ + public java.lang.String getUrl() { + java.lang.Object ref = url_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + url_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string url = 8; + */ + public com.google.protobuf.ByteString + getUrlBytes() { + java.lang.Object ref = url_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + url_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string url = 8; + */ + public Builder setUrl( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + url_ = value; + onChanged(); + return this; + } + /** + * string url = 8; + */ + public Builder clearUrl() { + + url_ = getDefaultInstance().getUrl(); + onChanged(); + return this; + } + /** + * string url = 8; + */ + public Builder setUrlBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + url_ = value; + onChanged(); + return this; + } + + private java.lang.Object property_ = ""; + /** + * string property = 9; + */ + public java.lang.String getProperty() { + java.lang.Object ref = property_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + property_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string property = 9; + */ + public com.google.protobuf.ByteString + getPropertyBytes() { + java.lang.Object ref = property_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + property_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string property = 9; + */ + public Builder setProperty( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + property_ = value; + onChanged(); + return this; + } + /** + * string property = 9; + */ + public Builder clearProperty() { + + property_ = getDefaultInstance().getProperty(); + onChanged(); + return this; + } + /** + * string property = 9; + */ + public Builder setPropertyBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + property_ = value; + onChanged(); + return this; + } + + private java.lang.Object fromNick_ = ""; + /** + * string from_nick = 10; + */ + public java.lang.String getFromNick() { + java.lang.Object ref = fromNick_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + fromNick_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string from_nick = 10; + */ + public com.google.protobuf.ByteString + getFromNickBytes() { + java.lang.Object ref = fromNick_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + fromNick_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string from_nick = 10; + */ + public Builder setFromNick( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + fromNick_ = value; + onChanged(); + return this; + } + /** + * string from_nick = 10; + */ + public Builder clearFromNick() { + + fromNick_ = getDefaultInstance().getFromNick(); + onChanged(); + return this; + } + /** + * string from_nick = 10; + */ + public Builder setFromNickBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + fromNick_ = value; + onChanged(); + return this; + } + + private java.lang.Object json_ = ""; + /** + * string json = 11; + */ + public java.lang.String getJson() { + java.lang.Object ref = json_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + json_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string json = 11; + */ + public com.google.protobuf.ByteString + getJsonBytes() { + java.lang.Object ref = json_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + json_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string json = 11; + */ + public Builder setJson( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + json_ = value; + onChanged(); + return this; + } + /** + * string json = 11; + */ + public Builder clearJson() { + + json_ = getDefaultInstance().getJson(); + onChanged(); + return this; + } + /** + * string json = 11; + */ + public Builder setJsonBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + json_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.zpf.im.common.bean.msg.MessageRequest) + } + + // @@protoc_insertion_point(class_scope:com.zpf.im.common.bean.msg.MessageRequest) + private static final com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest(); + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MessageRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MessageRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface MessageResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.zpf.im.common.bean.msg.MessageResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * bool result = 1; + */ + boolean getResult(); + + /** + * uint32 code = 2; + */ + int getCode(); + + /** + * string info = 3; + */ + java.lang.String getInfo(); + /** + * string info = 3; + */ + com.google.protobuf.ByteString + getInfoBytes(); + + /** + * uint32 expose = 4; + */ + int getExpose(); + + /** + * bool last_block = 5; + */ + boolean getLastBlock(); + + /** + * fixed32 block_index = 6; + */ + int getBlockIndex(); + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.MessageResponse} + */ + public static final class MessageResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.zpf.im.common.bean.msg.MessageResponse) + MessageResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use MessageResponse.newBuilder() to construct. + private MessageResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MessageResponse() { + result_ = false; + code_ = 0; + info_ = ""; + expose_ = 0; + lastBlock_ = false; + blockIndex_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MessageResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + result_ = input.readBool(); + break; + } + case 16: { + + code_ = input.readUInt32(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + info_ = s; + break; + } + case 32: { + + expose_ = input.readUInt32(); + break; + } + case 40: { + + lastBlock_ = input.readBool(); + break; + } + case 53: { + + blockIndex_ = input.readFixed32(); + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.class, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder.class); + } + + public static final int RESULT_FIELD_NUMBER = 1; + private boolean result_; + /** + * bool result = 1; + */ + public boolean getResult() { + return result_; + } + + public static final int CODE_FIELD_NUMBER = 2; + private int code_; + /** + * uint32 code = 2; + */ + public int getCode() { + return code_; + } + + public static final int INFO_FIELD_NUMBER = 3; + private volatile java.lang.Object info_; + /** + * string info = 3; + */ + public java.lang.String getInfo() { + java.lang.Object ref = info_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + info_ = s; + return s; + } + } + /** + * string info = 3; + */ + public com.google.protobuf.ByteString + getInfoBytes() { + java.lang.Object ref = info_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + info_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int EXPOSE_FIELD_NUMBER = 4; + private int expose_; + /** + * uint32 expose = 4; + */ + public int getExpose() { + return expose_; + } + + public static final int LAST_BLOCK_FIELD_NUMBER = 5; + private boolean lastBlock_; + /** + * bool last_block = 5; + */ + public boolean getLastBlock() { + return lastBlock_; + } + + public static final int BLOCK_INDEX_FIELD_NUMBER = 6; + private int blockIndex_; + /** + * fixed32 block_index = 6; + */ + public int getBlockIndex() { + return blockIndex_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (result_ != false) { + output.writeBool(1, result_); + } + if (code_ != 0) { + output.writeUInt32(2, code_); + } + if (!getInfoBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, info_); + } + if (expose_ != 0) { + output.writeUInt32(4, expose_); + } + if (lastBlock_ != false) { + output.writeBool(5, lastBlock_); + } + if (blockIndex_ != 0) { + output.writeFixed32(6, blockIndex_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (result_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(1, result_); + } + if (code_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, code_); + } + if (!getInfoBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, info_); + } + if (expose_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, expose_); + } + if (lastBlock_ != false) { + size += com.google.protobuf.CodedOutputStream + .computeBoolSize(5, lastBlock_); + } + if (blockIndex_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeFixed32Size(6, blockIndex_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse)) { + return super.equals(obj); + } + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse other = (com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse) obj; + + boolean result = true; + result = result && (getResult() + == other.getResult()); + result = result && (getCode() + == other.getCode()); + result = result && getInfo() + .equals(other.getInfo()); + result = result && (getExpose() + == other.getExpose()); + result = result && (getLastBlock() + == other.getLastBlock()); + result = result && (getBlockIndex() + == other.getBlockIndex()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + RESULT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getResult()); + hash = (37 * hash) + CODE_FIELD_NUMBER; + hash = (53 * hash) + getCode(); + hash = (37 * hash) + INFO_FIELD_NUMBER; + hash = (53 * hash) + getInfo().hashCode(); + hash = (37 * hash) + EXPOSE_FIELD_NUMBER; + hash = (53 * hash) + getExpose(); + hash = (37 * hash) + LAST_BLOCK_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( + getLastBlock()); + hash = (37 * hash) + BLOCK_INDEX_FIELD_NUMBER; + hash = (53 * hash) + getBlockIndex(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.MessageResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.zpf.im.common.bean.msg.MessageResponse) + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.class, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder.class); + } + + // Construct using com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + result_ = false; + + code_ = 0; + + info_ = ""; + + expose_ = 0; + + lastBlock_ = false; + + blockIndex_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageResponse_descriptor; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse getDefaultInstanceForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse build() { + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse buildPartial() { + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse result = new com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse(this); + result.result_ = result_; + result.code_ = code_; + result.info_ = info_; + result.expose_ = expose_; + result.lastBlock_ = lastBlock_; + result.blockIndex_ = blockIndex_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse) { + return mergeFrom((com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse other) { + if (other == com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.getDefaultInstance()) return this; + if (other.getResult() != false) { + setResult(other.getResult()); + } + if (other.getCode() != 0) { + setCode(other.getCode()); + } + if (!other.getInfo().isEmpty()) { + info_ = other.info_; + onChanged(); + } + if (other.getExpose() != 0) { + setExpose(other.getExpose()); + } + if (other.getLastBlock() != false) { + setLastBlock(other.getLastBlock()); + } + if (other.getBlockIndex() != 0) { + setBlockIndex(other.getBlockIndex()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean result_ ; + /** + * bool result = 1; + */ + public boolean getResult() { + return result_; + } + /** + * bool result = 1; + */ + public Builder setResult(boolean value) { + + result_ = value; + onChanged(); + return this; + } + /** + * bool result = 1; + */ + public Builder clearResult() { + + result_ = false; + onChanged(); + return this; + } + + private int code_ ; + /** + * uint32 code = 2; + */ + public int getCode() { + return code_; + } + /** + * uint32 code = 2; + */ + public Builder setCode(int value) { + + code_ = value; + onChanged(); + return this; + } + /** + * uint32 code = 2; + */ + public Builder clearCode() { + + code_ = 0; + onChanged(); + return this; + } + + private java.lang.Object info_ = ""; + /** + * string info = 3; + */ + public java.lang.String getInfo() { + java.lang.Object ref = info_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + info_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string info = 3; + */ + public com.google.protobuf.ByteString + getInfoBytes() { + java.lang.Object ref = info_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + info_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string info = 3; + */ + public Builder setInfo( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + info_ = value; + onChanged(); + return this; + } + /** + * string info = 3; + */ + public Builder clearInfo() { + + info_ = getDefaultInstance().getInfo(); + onChanged(); + return this; + } + /** + * string info = 3; + */ + public Builder setInfoBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + info_ = value; + onChanged(); + return this; + } + + private int expose_ ; + /** + * uint32 expose = 4; + */ + public int getExpose() { + return expose_; + } + /** + * uint32 expose = 4; + */ + public Builder setExpose(int value) { + + expose_ = value; + onChanged(); + return this; + } + /** + * uint32 expose = 4; + */ + public Builder clearExpose() { + + expose_ = 0; + onChanged(); + return this; + } + + private boolean lastBlock_ ; + /** + * bool last_block = 5; + */ + public boolean getLastBlock() { + return lastBlock_; + } + /** + * bool last_block = 5; + */ + public Builder setLastBlock(boolean value) { + + lastBlock_ = value; + onChanged(); + return this; + } + /** + * bool last_block = 5; + */ + public Builder clearLastBlock() { + + lastBlock_ = false; + onChanged(); + return this; + } + + private int blockIndex_ ; + /** + * fixed32 block_index = 6; + */ + public int getBlockIndex() { + return blockIndex_; + } + /** + * fixed32 block_index = 6; + */ + public Builder setBlockIndex(int value) { + + blockIndex_ = value; + onChanged(); + return this; + } + /** + * fixed32 block_index = 6; + */ + public Builder clearBlockIndex() { + + blockIndex_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.zpf.im.common.bean.msg.MessageResponse) + } + + // @@protoc_insertion_point(class_scope:com.zpf.im.common.bean.msg.MessageResponse) + private static final com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse(); + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MessageResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MessageResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface MessageNotificationOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.zpf.im.common.bean.msg.MessageNotification) + com.google.protobuf.MessageOrBuilder { + + /** + * uint32 msg_type = 1; + */ + int getMsgType(); + + /** + * bytes sender = 2; + */ + com.google.protobuf.ByteString getSender(); + + /** + * string json = 3; + */ + java.lang.String getJson(); + /** + * string json = 3; + */ + com.google.protobuf.ByteString + getJsonBytes(); + + /** + * string timestamp = 4; + */ + java.lang.String getTimestamp(); + /** + * string timestamp = 4; + */ + com.google.protobuf.ByteString + getTimestampBytes(); + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.MessageNotification} + */ + public static final class MessageNotification extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.zpf.im.common.bean.msg.MessageNotification) + MessageNotificationOrBuilder { + private static final long serialVersionUID = 0L; + // Use MessageNotification.newBuilder() to construct. + private MessageNotification(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private MessageNotification() { + msgType_ = 0; + sender_ = com.google.protobuf.ByteString.EMPTY; + json_ = ""; + timestamp_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private MessageNotification( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + msgType_ = input.readUInt32(); + break; + } + case 18: { + + sender_ = input.readBytes(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + json_ = s; + break; + } + case 34: { + java.lang.String s = input.readStringRequireUtf8(); + + timestamp_ = s; + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageNotification_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageNotification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.class, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder.class); + } + + public static final int MSG_TYPE_FIELD_NUMBER = 1; + private int msgType_; + /** + * uint32 msg_type = 1; + */ + public int getMsgType() { + return msgType_; + } + + public static final int SENDER_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString sender_; + /** + * bytes sender = 2; + */ + public com.google.protobuf.ByteString getSender() { + return sender_; + } + + public static final int JSON_FIELD_NUMBER = 3; + private volatile java.lang.Object json_; + /** + * string json = 3; + */ + public java.lang.String getJson() { + java.lang.Object ref = json_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + json_ = s; + return s; + } + } + /** + * string json = 3; + */ + public com.google.protobuf.ByteString + getJsonBytes() { + java.lang.Object ref = json_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + json_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int TIMESTAMP_FIELD_NUMBER = 4; + private volatile java.lang.Object timestamp_; + /** + * string timestamp = 4; + */ + public java.lang.String getTimestamp() { + java.lang.Object ref = timestamp_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + timestamp_ = s; + return s; + } + } + /** + * string timestamp = 4; + */ + public com.google.protobuf.ByteString + getTimestampBytes() { + java.lang.Object ref = timestamp_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + timestamp_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (msgType_ != 0) { + output.writeUInt32(1, msgType_); + } + if (!sender_.isEmpty()) { + output.writeBytes(2, sender_); + } + if (!getJsonBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, json_); + } + if (!getTimestampBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, timestamp_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (msgType_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, msgType_); + } + if (!sender_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, sender_); + } + if (!getJsonBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, json_); + } + if (!getTimestampBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, timestamp_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification)) { + return super.equals(obj); + } + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification other = (com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification) obj; + + boolean result = true; + result = result && (getMsgType() + == other.getMsgType()); + result = result && getSender() + .equals(other.getSender()); + result = result && getJson() + .equals(other.getJson()); + result = result && getTimestamp() + .equals(other.getTimestamp()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + MSG_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getMsgType(); + hash = (37 * hash) + SENDER_FIELD_NUMBER; + hash = (53 * hash) + getSender().hashCode(); + hash = (37 * hash) + JSON_FIELD_NUMBER; + hash = (53 * hash) + getJson().hashCode(); + hash = (37 * hash) + TIMESTAMP_FIELD_NUMBER; + hash = (53 * hash) + getTimestamp().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.MessageNotification} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.zpf.im.common.bean.msg.MessageNotification) + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageNotification_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageNotification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.class, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder.class); + } + + // Construct using com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + msgType_ = 0; + + sender_ = com.google.protobuf.ByteString.EMPTY; + + json_ = ""; + + timestamp_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_MessageNotification_descriptor; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification getDefaultInstanceForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.getDefaultInstance(); + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification build() { + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification buildPartial() { + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification result = new com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification(this); + result.msgType_ = msgType_; + result.sender_ = sender_; + result.json_ = json_; + result.timestamp_ = timestamp_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification) { + return mergeFrom((com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification other) { + if (other == com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.getDefaultInstance()) return this; + if (other.getMsgType() != 0) { + setMsgType(other.getMsgType()); + } + if (other.getSender() != com.google.protobuf.ByteString.EMPTY) { + setSender(other.getSender()); + } + if (!other.getJson().isEmpty()) { + json_ = other.json_; + onChanged(); + } + if (!other.getTimestamp().isEmpty()) { + timestamp_ = other.timestamp_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int msgType_ ; + /** + * uint32 msg_type = 1; + */ + public int getMsgType() { + return msgType_; + } + /** + * uint32 msg_type = 1; + */ + public Builder setMsgType(int value) { + + msgType_ = value; + onChanged(); + return this; + } + /** + * uint32 msg_type = 1; + */ + public Builder clearMsgType() { + + msgType_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString sender_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes sender = 2; + */ + public com.google.protobuf.ByteString getSender() { + return sender_; + } + /** + * bytes sender = 2; + */ + public Builder setSender(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + sender_ = value; + onChanged(); + return this; + } + /** + * bytes sender = 2; + */ + public Builder clearSender() { + + sender_ = getDefaultInstance().getSender(); + onChanged(); + return this; + } + + private java.lang.Object json_ = ""; + /** + * string json = 3; + */ + public java.lang.String getJson() { + java.lang.Object ref = json_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + json_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string json = 3; + */ + public com.google.protobuf.ByteString + getJsonBytes() { + java.lang.Object ref = json_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + json_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string json = 3; + */ + public Builder setJson( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + json_ = value; + onChanged(); + return this; + } + /** + * string json = 3; + */ + public Builder clearJson() { + + json_ = getDefaultInstance().getJson(); + onChanged(); + return this; + } + /** + * string json = 3; + */ + public Builder setJsonBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + json_ = value; + onChanged(); + return this; + } + + private java.lang.Object timestamp_ = ""; + /** + * string timestamp = 4; + */ + public java.lang.String getTimestamp() { + java.lang.Object ref = timestamp_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + timestamp_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string timestamp = 4; + */ + public com.google.protobuf.ByteString + getTimestampBytes() { + java.lang.Object ref = timestamp_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + timestamp_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string timestamp = 4; + */ + public Builder setTimestamp( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + timestamp_ = value; + onChanged(); + return this; + } + /** + * string timestamp = 4; + */ + public Builder clearTimestamp() { + + timestamp_ = getDefaultInstance().getTimestamp(); + onChanged(); + return this; + } + /** + * string timestamp = 4; + */ + public Builder setTimestampBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + timestamp_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.zpf.im.common.bean.msg.MessageNotification) + } + + // @@protoc_insertion_point(class_scope:com.zpf.im.common.bean.msg.MessageNotification) + private static final com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification(); + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MessageNotification parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new MessageNotification(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface MessageOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.zpf.im.common.bean.msg.Message) + com.google.protobuf.MessageOrBuilder { + + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + int getTypeValue(); + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + com.zpf.im.common.bean.msg.ProtoMsg.HeadType getType(); + + /** + * uint64 sequence = 2; + */ + long getSequence(); + + /** + * string session_id = 3; + */ + java.lang.String getSessionId(); + /** + * string session_id = 3; + */ + com.google.protobuf.ByteString + getSessionIdBytes(); + + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + boolean hasLoginRequest(); + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest getLoginRequest(); + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder getLoginRequestOrBuilder(); + + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + boolean hasLoginResponse(); + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse getLoginResponse(); + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder getLoginResponseOrBuilder(); + + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + boolean hasMessageRequest(); + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest getMessageRequest(); + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder getMessageRequestOrBuilder(); + + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + boolean hasMessageResponse(); + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse getMessageResponse(); + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder getMessageResponseOrBuilder(); + + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + boolean hasNotification(); + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification getNotification(); + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder getNotificationOrBuilder(); + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.Message} + */ + public static final class Message extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.zpf.im.common.bean.msg.Message) + MessageOrBuilder { + private static final long serialVersionUID = 0L; + // Use Message.newBuilder() to construct. + private Message(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Message() { + type_ = 0; + sequence_ = 0L; + sessionId_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Message( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int rawValue = input.readEnum(); + + type_ = rawValue; + break; + } + case 16: { + + sequence_ = input.readUInt64(); + break; + } + case 26: { + java.lang.String s = input.readStringRequireUtf8(); + + sessionId_ = s; + break; + } + case 34: { + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder subBuilder = null; + if (loginRequest_ != null) { + subBuilder = loginRequest_.toBuilder(); + } + loginRequest_ = input.readMessage(com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(loginRequest_); + loginRequest_ = subBuilder.buildPartial(); + } + + break; + } + case 42: { + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder subBuilder = null; + if (loginResponse_ != null) { + subBuilder = loginResponse_.toBuilder(); + } + loginResponse_ = input.readMessage(com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(loginResponse_); + loginResponse_ = subBuilder.buildPartial(); + } + + break; + } + case 50: { + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder subBuilder = null; + if (messageRequest_ != null) { + subBuilder = messageRequest_.toBuilder(); + } + messageRequest_ = input.readMessage(com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(messageRequest_); + messageRequest_ = subBuilder.buildPartial(); + } + + break; + } + case 58: { + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder subBuilder = null; + if (messageResponse_ != null) { + subBuilder = messageResponse_.toBuilder(); + } + messageResponse_ = input.readMessage(com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(messageResponse_); + messageResponse_ = subBuilder.buildPartial(); + } + + break; + } + case 66: { + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder subBuilder = null; + if (notification_ != null) { + subBuilder = notification_.toBuilder(); + } + notification_ = input.readMessage(com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(notification_); + notification_ = subBuilder.buildPartial(); + } + + break; + } + default: { + if (!parseUnknownFieldProto3( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_Message_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_Message_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.Message.class, com.zpf.im.common.bean.msg.ProtoMsg.Message.Builder.class); + } + + public static final int TYPE_FIELD_NUMBER = 1; + private int type_; + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public int getTypeValue() { + return type_; + } + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.HeadType getType() { + @SuppressWarnings("deprecation") + com.zpf.im.common.bean.msg.ProtoMsg.HeadType result = com.zpf.im.common.bean.msg.ProtoMsg.HeadType.valueOf(type_); + return result == null ? com.zpf.im.common.bean.msg.ProtoMsg.HeadType.UNRECOGNIZED : result; + } + + public static final int SEQUENCE_FIELD_NUMBER = 2; + private long sequence_; + /** + * uint64 sequence = 2; + */ + public long getSequence() { + return sequence_; + } + + public static final int SESSION_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object sessionId_; + /** + * string session_id = 3; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } + } + /** + * string session_id = 3; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LOGINREQUEST_FIELD_NUMBER = 4; + private com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest loginRequest_; + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public boolean hasLoginRequest() { + return loginRequest_ != null; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest getLoginRequest() { + return loginRequest_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.getDefaultInstance() : loginRequest_; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder getLoginRequestOrBuilder() { + return getLoginRequest(); + } + + public static final int LOGINRESPONSE_FIELD_NUMBER = 5; + private com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse loginResponse_; + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public boolean hasLoginResponse() { + return loginResponse_ != null; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse getLoginResponse() { + return loginResponse_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.getDefaultInstance() : loginResponse_; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder getLoginResponseOrBuilder() { + return getLoginResponse(); + } + + public static final int MESSAGEREQUEST_FIELD_NUMBER = 6; + private com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest messageRequest_; + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public boolean hasMessageRequest() { + return messageRequest_ != null; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest getMessageRequest() { + return messageRequest_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.getDefaultInstance() : messageRequest_; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder getMessageRequestOrBuilder() { + return getMessageRequest(); + } + + public static final int MESSAGERESPONSE_FIELD_NUMBER = 7; + private com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse messageResponse_; + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public boolean hasMessageResponse() { + return messageResponse_ != null; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse getMessageResponse() { + return messageResponse_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.getDefaultInstance() : messageResponse_; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder getMessageResponseOrBuilder() { + return getMessageResponse(); + } + + public static final int NOTIFICATION_FIELD_NUMBER = 8; + private com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification notification_; + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public boolean hasNotification() { + return notification_ != null; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification getNotification() { + return notification_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.getDefaultInstance() : notification_; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder getNotificationOrBuilder() { + return getNotification(); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (type_ != com.zpf.im.common.bean.msg.ProtoMsg.HeadType.LOGIN_REQUEST.getNumber()) { + output.writeEnum(1, type_); + } + if (sequence_ != 0L) { + output.writeUInt64(2, sequence_); + } + if (!getSessionIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, sessionId_); + } + if (loginRequest_ != null) { + output.writeMessage(4, getLoginRequest()); + } + if (loginResponse_ != null) { + output.writeMessage(5, getLoginResponse()); + } + if (messageRequest_ != null) { + output.writeMessage(6, getMessageRequest()); + } + if (messageResponse_ != null) { + output.writeMessage(7, getMessageResponse()); + } + if (notification_ != null) { + output.writeMessage(8, getNotification()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (type_ != com.zpf.im.common.bean.msg.ProtoMsg.HeadType.LOGIN_REQUEST.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, type_); + } + if (sequence_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(2, sequence_); + } + if (!getSessionIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, sessionId_); + } + if (loginRequest_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getLoginRequest()); + } + if (loginResponse_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, getLoginResponse()); + } + if (messageRequest_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getMessageRequest()); + } + if (messageResponse_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, getMessageResponse()); + } + if (notification_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, getNotification()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.zpf.im.common.bean.msg.ProtoMsg.Message)) { + return super.equals(obj); + } + com.zpf.im.common.bean.msg.ProtoMsg.Message other = (com.zpf.im.common.bean.msg.ProtoMsg.Message) obj; + + boolean result = true; + result = result && type_ == other.type_; + result = result && (getSequence() + == other.getSequence()); + result = result && getSessionId() + .equals(other.getSessionId()); + result = result && (hasLoginRequest() == other.hasLoginRequest()); + if (hasLoginRequest()) { + result = result && getLoginRequest() + .equals(other.getLoginRequest()); + } + result = result && (hasLoginResponse() == other.hasLoginResponse()); + if (hasLoginResponse()) { + result = result && getLoginResponse() + .equals(other.getLoginResponse()); + } + result = result && (hasMessageRequest() == other.hasMessageRequest()); + if (hasMessageRequest()) { + result = result && getMessageRequest() + .equals(other.getMessageRequest()); + } + result = result && (hasMessageResponse() == other.hasMessageResponse()); + if (hasMessageResponse()) { + result = result && getMessageResponse() + .equals(other.getMessageResponse()); + } + result = result && (hasNotification() == other.hasNotification()); + if (hasNotification()) { + result = result && getNotification() + .equals(other.getNotification()); + } + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + type_; + hash = (37 * hash) + SEQUENCE_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getSequence()); + hash = (37 * hash) + SESSION_ID_FIELD_NUMBER; + hash = (53 * hash) + getSessionId().hashCode(); + if (hasLoginRequest()) { + hash = (37 * hash) + LOGINREQUEST_FIELD_NUMBER; + hash = (53 * hash) + getLoginRequest().hashCode(); + } + if (hasLoginResponse()) { + hash = (37 * hash) + LOGINRESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getLoginResponse().hashCode(); + } + if (hasMessageRequest()) { + hash = (37 * hash) + MESSAGEREQUEST_FIELD_NUMBER; + hash = (53 * hash) + getMessageRequest().hashCode(); + } + if (hasMessageResponse()) { + hash = (37 * hash) + MESSAGERESPONSE_FIELD_NUMBER; + hash = (53 * hash) + getMessageResponse().hashCode(); + } + if (hasNotification()) { + hash = (37 * hash) + NOTIFICATION_FIELD_NUMBER; + hash = (53 * hash) + getNotification().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.zpf.im.common.bean.msg.ProtoMsg.Message parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.zpf.im.common.bean.msg.ProtoMsg.Message prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code com.zpf.im.common.bean.msg.Message} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.zpf.im.common.bean.msg.Message) + com.zpf.im.common.bean.msg.ProtoMsg.MessageOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_Message_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_Message_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.zpf.im.common.bean.msg.ProtoMsg.Message.class, com.zpf.im.common.bean.msg.ProtoMsg.Message.Builder.class); + } + + // Construct using com.zpf.im.common.bean.msg.ProtoMsg.Message.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + type_ = 0; + + sequence_ = 0L; + + sessionId_ = ""; + + if (loginRequestBuilder_ == null) { + loginRequest_ = null; + } else { + loginRequest_ = null; + loginRequestBuilder_ = null; + } + if (loginResponseBuilder_ == null) { + loginResponse_ = null; + } else { + loginResponse_ = null; + loginResponseBuilder_ = null; + } + if (messageRequestBuilder_ == null) { + messageRequest_ = null; + } else { + messageRequest_ = null; + messageRequestBuilder_ = null; + } + if (messageResponseBuilder_ == null) { + messageResponse_ = null; + } else { + messageResponse_ = null; + messageResponseBuilder_ = null; + } + if (notificationBuilder_ == null) { + notification_ = null; + } else { + notification_ = null; + notificationBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.internal_static_com_zpf_im_common_bean_msg_Message_descriptor; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.Message getDefaultInstanceForType() { + return com.zpf.im.common.bean.msg.ProtoMsg.Message.getDefaultInstance(); + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.Message build() { + com.zpf.im.common.bean.msg.ProtoMsg.Message result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.Message buildPartial() { + com.zpf.im.common.bean.msg.ProtoMsg.Message result = new com.zpf.im.common.bean.msg.ProtoMsg.Message(this); + result.type_ = type_; + result.sequence_ = sequence_; + result.sessionId_ = sessionId_; + if (loginRequestBuilder_ == null) { + result.loginRequest_ = loginRequest_; + } else { + result.loginRequest_ = loginRequestBuilder_.build(); + } + if (loginResponseBuilder_ == null) { + result.loginResponse_ = loginResponse_; + } else { + result.loginResponse_ = loginResponseBuilder_.build(); + } + if (messageRequestBuilder_ == null) { + result.messageRequest_ = messageRequest_; + } else { + result.messageRequest_ = messageRequestBuilder_.build(); + } + if (messageResponseBuilder_ == null) { + result.messageResponse_ = messageResponse_; + } else { + result.messageResponse_ = messageResponseBuilder_.build(); + } + if (notificationBuilder_ == null) { + result.notification_ = notification_; + } else { + result.notification_ = notificationBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.zpf.im.common.bean.msg.ProtoMsg.Message) { + return mergeFrom((com.zpf.im.common.bean.msg.ProtoMsg.Message)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.zpf.im.common.bean.msg.ProtoMsg.Message other) { + if (other == com.zpf.im.common.bean.msg.ProtoMsg.Message.getDefaultInstance()) return this; + if (other.type_ != 0) { + setTypeValue(other.getTypeValue()); + } + if (other.getSequence() != 0L) { + setSequence(other.getSequence()); + } + if (!other.getSessionId().isEmpty()) { + sessionId_ = other.sessionId_; + onChanged(); + } + if (other.hasLoginRequest()) { + mergeLoginRequest(other.getLoginRequest()); + } + if (other.hasLoginResponse()) { + mergeLoginResponse(other.getLoginResponse()); + } + if (other.hasMessageRequest()) { + mergeMessageRequest(other.getMessageRequest()); + } + if (other.hasMessageResponse()) { + mergeMessageResponse(other.getMessageResponse()); + } + if (other.hasNotification()) { + mergeNotification(other.getNotification()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.zpf.im.common.bean.msg.ProtoMsg.Message parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.zpf.im.common.bean.msg.ProtoMsg.Message) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int type_ = 0; + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public int getTypeValue() { + return type_; + } + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public Builder setTypeValue(int value) { + type_ = value; + onChanged(); + return this; + } + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.HeadType getType() { + @SuppressWarnings("deprecation") + com.zpf.im.common.bean.msg.ProtoMsg.HeadType result = com.zpf.im.common.bean.msg.ProtoMsg.HeadType.valueOf(type_); + return result == null ? com.zpf.im.common.bean.msg.ProtoMsg.HeadType.UNRECOGNIZED : result; + } + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public Builder setType(com.zpf.im.common.bean.msg.ProtoMsg.HeadType value) { + if (value == null) { + throw new NullPointerException(); + } + + type_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .com.zpf.im.common.bean.msg.HeadType type = 1; + */ + public Builder clearType() { + + type_ = 0; + onChanged(); + return this; + } + + private long sequence_ ; + /** + * uint64 sequence = 2; + */ + public long getSequence() { + return sequence_; + } + /** + * uint64 sequence = 2; + */ + public Builder setSequence(long value) { + + sequence_ = value; + onChanged(); + return this; + } + /** + * uint64 sequence = 2; + */ + public Builder clearSequence() { + + sequence_ = 0L; + onChanged(); + return this; + } + + private java.lang.Object sessionId_ = ""; + /** + * string session_id = 3; + */ + public java.lang.String getSessionId() { + java.lang.Object ref = sessionId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sessionId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string session_id = 3; + */ + public com.google.protobuf.ByteString + getSessionIdBytes() { + java.lang.Object ref = sessionId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + sessionId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string session_id = 3; + */ + public Builder setSessionId( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sessionId_ = value; + onChanged(); + return this; + } + /** + * string session_id = 3; + */ + public Builder clearSessionId() { + + sessionId_ = getDefaultInstance().getSessionId(); + onChanged(); + return this; + } + /** + * string session_id = 3; + */ + public Builder setSessionIdBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sessionId_ = value; + onChanged(); + return this; + } + + private com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest loginRequest_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder> loginRequestBuilder_; + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public boolean hasLoginRequest() { + return loginRequestBuilder_ != null || loginRequest_ != null; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest getLoginRequest() { + if (loginRequestBuilder_ == null) { + return loginRequest_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.getDefaultInstance() : loginRequest_; + } else { + return loginRequestBuilder_.getMessage(); + } + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public Builder setLoginRequest(com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest value) { + if (loginRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + loginRequest_ = value; + onChanged(); + } else { + loginRequestBuilder_.setMessage(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public Builder setLoginRequest( + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder builderForValue) { + if (loginRequestBuilder_ == null) { + loginRequest_ = builderForValue.build(); + onChanged(); + } else { + loginRequestBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public Builder mergeLoginRequest(com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest value) { + if (loginRequestBuilder_ == null) { + if (loginRequest_ != null) { + loginRequest_ = + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.newBuilder(loginRequest_).mergeFrom(value).buildPartial(); + } else { + loginRequest_ = value; + } + onChanged(); + } else { + loginRequestBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public Builder clearLoginRequest() { + if (loginRequestBuilder_ == null) { + loginRequest_ = null; + onChanged(); + } else { + loginRequest_ = null; + loginRequestBuilder_ = null; + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder getLoginRequestBuilder() { + + onChanged(); + return getLoginRequestFieldBuilder().getBuilder(); + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder getLoginRequestOrBuilder() { + if (loginRequestBuilder_ != null) { + return loginRequestBuilder_.getMessageOrBuilder(); + } else { + return loginRequest_ == null ? + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.getDefaultInstance() : loginRequest_; + } + } + /** + * .com.zpf.im.common.bean.msg.LoginRequest loginRequest = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder> + getLoginRequestFieldBuilder() { + if (loginRequestBuilder_ == null) { + loginRequestBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequest.Builder, com.zpf.im.common.bean.msg.ProtoMsg.LoginRequestOrBuilder>( + getLoginRequest(), + getParentForChildren(), + isClean()); + loginRequest_ = null; + } + return loginRequestBuilder_; + } + + private com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse loginResponse_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder> loginResponseBuilder_; + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public boolean hasLoginResponse() { + return loginResponseBuilder_ != null || loginResponse_ != null; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse getLoginResponse() { + if (loginResponseBuilder_ == null) { + return loginResponse_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.getDefaultInstance() : loginResponse_; + } else { + return loginResponseBuilder_.getMessage(); + } + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public Builder setLoginResponse(com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse value) { + if (loginResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + loginResponse_ = value; + onChanged(); + } else { + loginResponseBuilder_.setMessage(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public Builder setLoginResponse( + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder builderForValue) { + if (loginResponseBuilder_ == null) { + loginResponse_ = builderForValue.build(); + onChanged(); + } else { + loginResponseBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public Builder mergeLoginResponse(com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse value) { + if (loginResponseBuilder_ == null) { + if (loginResponse_ != null) { + loginResponse_ = + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.newBuilder(loginResponse_).mergeFrom(value).buildPartial(); + } else { + loginResponse_ = value; + } + onChanged(); + } else { + loginResponseBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public Builder clearLoginResponse() { + if (loginResponseBuilder_ == null) { + loginResponse_ = null; + onChanged(); + } else { + loginResponse_ = null; + loginResponseBuilder_ = null; + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder getLoginResponseBuilder() { + + onChanged(); + return getLoginResponseFieldBuilder().getBuilder(); + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder getLoginResponseOrBuilder() { + if (loginResponseBuilder_ != null) { + return loginResponseBuilder_.getMessageOrBuilder(); + } else { + return loginResponse_ == null ? + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.getDefaultInstance() : loginResponse_; + } + } + /** + * .com.zpf.im.common.bean.msg.LoginResponse loginResponse = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder> + getLoginResponseFieldBuilder() { + if (loginResponseBuilder_ == null) { + loginResponseBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponse.Builder, com.zpf.im.common.bean.msg.ProtoMsg.LoginResponseOrBuilder>( + getLoginResponse(), + getParentForChildren(), + isClean()); + loginResponse_ = null; + } + return loginResponseBuilder_; + } + + private com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest messageRequest_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder> messageRequestBuilder_; + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public boolean hasMessageRequest() { + return messageRequestBuilder_ != null || messageRequest_ != null; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest getMessageRequest() { + if (messageRequestBuilder_ == null) { + return messageRequest_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.getDefaultInstance() : messageRequest_; + } else { + return messageRequestBuilder_.getMessage(); + } + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public Builder setMessageRequest(com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest value) { + if (messageRequestBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + messageRequest_ = value; + onChanged(); + } else { + messageRequestBuilder_.setMessage(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public Builder setMessageRequest( + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder builderForValue) { + if (messageRequestBuilder_ == null) { + messageRequest_ = builderForValue.build(); + onChanged(); + } else { + messageRequestBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public Builder mergeMessageRequest(com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest value) { + if (messageRequestBuilder_ == null) { + if (messageRequest_ != null) { + messageRequest_ = + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.newBuilder(messageRequest_).mergeFrom(value).buildPartial(); + } else { + messageRequest_ = value; + } + onChanged(); + } else { + messageRequestBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public Builder clearMessageRequest() { + if (messageRequestBuilder_ == null) { + messageRequest_ = null; + onChanged(); + } else { + messageRequest_ = null; + messageRequestBuilder_ = null; + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder getMessageRequestBuilder() { + + onChanged(); + return getMessageRequestFieldBuilder().getBuilder(); + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder getMessageRequestOrBuilder() { + if (messageRequestBuilder_ != null) { + return messageRequestBuilder_.getMessageOrBuilder(); + } else { + return messageRequest_ == null ? + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.getDefaultInstance() : messageRequest_; + } + } + /** + * .com.zpf.im.common.bean.msg.MessageRequest messageRequest = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder> + getMessageRequestFieldBuilder() { + if (messageRequestBuilder_ == null) { + messageRequestBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequest.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageRequestOrBuilder>( + getMessageRequest(), + getParentForChildren(), + isClean()); + messageRequest_ = null; + } + return messageRequestBuilder_; + } + + private com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse messageResponse_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder> messageResponseBuilder_; + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public boolean hasMessageResponse() { + return messageResponseBuilder_ != null || messageResponse_ != null; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse getMessageResponse() { + if (messageResponseBuilder_ == null) { + return messageResponse_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.getDefaultInstance() : messageResponse_; + } else { + return messageResponseBuilder_.getMessage(); + } + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public Builder setMessageResponse(com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse value) { + if (messageResponseBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + messageResponse_ = value; + onChanged(); + } else { + messageResponseBuilder_.setMessage(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public Builder setMessageResponse( + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder builderForValue) { + if (messageResponseBuilder_ == null) { + messageResponse_ = builderForValue.build(); + onChanged(); + } else { + messageResponseBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public Builder mergeMessageResponse(com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse value) { + if (messageResponseBuilder_ == null) { + if (messageResponse_ != null) { + messageResponse_ = + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.newBuilder(messageResponse_).mergeFrom(value).buildPartial(); + } else { + messageResponse_ = value; + } + onChanged(); + } else { + messageResponseBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public Builder clearMessageResponse() { + if (messageResponseBuilder_ == null) { + messageResponse_ = null; + onChanged(); + } else { + messageResponse_ = null; + messageResponseBuilder_ = null; + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder getMessageResponseBuilder() { + + onChanged(); + return getMessageResponseFieldBuilder().getBuilder(); + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder getMessageResponseOrBuilder() { + if (messageResponseBuilder_ != null) { + return messageResponseBuilder_.getMessageOrBuilder(); + } else { + return messageResponse_ == null ? + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.getDefaultInstance() : messageResponse_; + } + } + /** + * .com.zpf.im.common.bean.msg.MessageResponse messageResponse = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder> + getMessageResponseFieldBuilder() { + if (messageResponseBuilder_ == null) { + messageResponseBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponse.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageResponseOrBuilder>( + getMessageResponse(), + getParentForChildren(), + isClean()); + messageResponse_ = null; + } + return messageResponseBuilder_; + } + + private com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification notification_ = null; + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder> notificationBuilder_; + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public boolean hasNotification() { + return notificationBuilder_ != null || notification_ != null; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification getNotification() { + if (notificationBuilder_ == null) { + return notification_ == null ? com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.getDefaultInstance() : notification_; + } else { + return notificationBuilder_.getMessage(); + } + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public Builder setNotification(com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification value) { + if (notificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + notification_ = value; + onChanged(); + } else { + notificationBuilder_.setMessage(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public Builder setNotification( + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder builderForValue) { + if (notificationBuilder_ == null) { + notification_ = builderForValue.build(); + onChanged(); + } else { + notificationBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public Builder mergeNotification(com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification value) { + if (notificationBuilder_ == null) { + if (notification_ != null) { + notification_ = + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.newBuilder(notification_).mergeFrom(value).buildPartial(); + } else { + notification_ = value; + } + onChanged(); + } else { + notificationBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public Builder clearNotification() { + if (notificationBuilder_ == null) { + notification_ = null; + onChanged(); + } else { + notification_ = null; + notificationBuilder_ = null; + } + + return this; + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder getNotificationBuilder() { + + onChanged(); + return getNotificationFieldBuilder().getBuilder(); + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + public com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder getNotificationOrBuilder() { + if (notificationBuilder_ != null) { + return notificationBuilder_.getMessageOrBuilder(); + } else { + return notification_ == null ? + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.getDefaultInstance() : notification_; + } + } + /** + * .com.zpf.im.common.bean.msg.MessageNotification notification = 8; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder> + getNotificationFieldBuilder() { + if (notificationBuilder_ == null) { + notificationBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotification.Builder, com.zpf.im.common.bean.msg.ProtoMsg.MessageNotificationOrBuilder>( + getNotification(), + getParentForChildren(), + isClean()); + notification_ = null; + } + return notificationBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.zpf.im.common.bean.msg.Message) + } + + // @@protoc_insertion_point(class_scope:com.zpf.im.common.bean.msg.Message) + private static final com.zpf.im.common.bean.msg.ProtoMsg.Message DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.zpf.im.common.bean.msg.ProtoMsg.Message(); + } + + public static com.zpf.im.common.bean.msg.ProtoMsg.Message getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Message parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Message(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.zpf.im.common.bean.msg.ProtoMsg.Message getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_zpf_im_common_bean_msg_LoginRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_zpf_im_common_bean_msg_LoginRequest_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_zpf_im_common_bean_msg_LoginResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_zpf_im_common_bean_msg_LoginResponse_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_zpf_im_common_bean_msg_MessageRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_zpf_im_common_bean_msg_MessageRequest_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_zpf_im_common_bean_msg_MessageResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_zpf_im_common_bean_msg_MessageResponse_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_zpf_im_common_bean_msg_MessageNotification_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_zpf_im_common_bean_msg_MessageNotification_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_zpf_im_common_bean_msg_Message_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_zpf_im_common_bean_msg_Message_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\016ProtoMsg.proto\022\032com.zpf.im.common.bean" + + ".msg\"c\n\014LoginRequest\022\013\n\003uid\030\001 \001(\t\022\020\n\010dev" + + "iceId\030\002 \001(\t\022\r\n\005token\030\003 \001(\t\022\020\n\010platform\030\004" + + " \001(\r\022\023\n\013app_version\030\005 \001(\t\"K\n\rLoginRespon" + + "se\022\016\n\006result\030\001 \001(\010\022\014\n\004code\030\002 \001(\r\022\014\n\004info" + + "\030\003 \001(\t\022\016\n\006expose\030\004 \001(\r\"\253\001\n\016MessageReques" + + "t\022\016\n\006msg_id\030\001 \001(\004\022\014\n\004from\030\002 \001(\t\022\n\n\002to\030\003 " + + "\001(\t\022\014\n\004time\030\004 \001(\004\022\020\n\010msg_type\030\005 \001(\r\022\017\n\007c" + + "ontent\030\006 \001(\t\022\013\n\003url\030\010 \001(\t\022\020\n\010property\030\t " + + "\001(\t\022\021\n\tfrom_nick\030\n \001(\t\022\014\n\004json\030\013 \001(\t\"v\n\017" + + "MessageResponse\022\016\n\006result\030\001 \001(\010\022\014\n\004code\030" + + "\002 \001(\r\022\014\n\004info\030\003 \001(\t\022\016\n\006expose\030\004 \001(\r\022\022\n\nl" + + "ast_block\030\005 \001(\010\022\023\n\013block_index\030\006 \001(\007\"X\n\023" + + "MessageNotification\022\020\n\010msg_type\030\001 \001(\r\022\016\n" + + "\006sender\030\002 \001(\014\022\014\n\004json\030\003 \001(\t\022\021\n\ttimestamp" + + "\030\004 \001(\t\"\266\003\n\007Message\0222\n\004type\030\001 \001(\0162$.com.z" + + "pf.im.common.bean.msg.HeadType\022\020\n\010sequen" + + "ce\030\002 \001(\004\022\022\n\nsession_id\030\003 \001(\t\022>\n\014loginReq" + + "uest\030\004 \001(\0132(.com.zpf.im.common.bean.msg." + + "LoginRequest\022@\n\rloginResponse\030\005 \001(\0132).co" + + "m.zpf.im.common.bean.msg.LoginResponse\022B" + + "\n\016messageRequest\030\006 \001(\0132*.com.zpf.im.comm" + + "on.bean.msg.MessageRequest\022D\n\017messageRes" + + "ponse\030\007 \001(\0132+.com.zpf.im.common.bean.msg" + + ".MessageResponse\022E\n\014notification\030\010 \001(\0132/" + + ".com.zpf.im.common.bean.msg.MessageNotif" + + "ication*\316\001\n\010HeadType\022\021\n\rLOGIN_REQUEST\020\000\022" + + "\022\n\016LOGIN_RESPONSE\020\001\022\022\n\016LOGOUT_REQUEST\020\002\022" + + "\023\n\017LOGOUT_RESPONSE\020\003\022\025\n\021KEEPALIVE_REQUES" + + "T\020\004\022\026\n\022KEEPALIVE_RESPONSE\020\005\022\023\n\017MESSAGE_R" + + "EQUEST\020\006\022\024\n\020MESSAGE_RESPONSE\020\007\022\030\n\024MESSAG" + + "E_NOTIFICATION\020\010b\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_com_zpf_im_common_bean_msg_LoginRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_zpf_im_common_bean_msg_LoginRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_zpf_im_common_bean_msg_LoginRequest_descriptor, + new java.lang.String[] { "Uid", "DeviceId", "Token", "Platform", "AppVersion", }); + internal_static_com_zpf_im_common_bean_msg_LoginResponse_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_zpf_im_common_bean_msg_LoginResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_zpf_im_common_bean_msg_LoginResponse_descriptor, + new java.lang.String[] { "Result", "Code", "Info", "Expose", }); + internal_static_com_zpf_im_common_bean_msg_MessageRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_zpf_im_common_bean_msg_MessageRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_zpf_im_common_bean_msg_MessageRequest_descriptor, + new java.lang.String[] { "MsgId", "From", "To", "Time", "MsgType", "Content", "Url", "Property", "FromNick", "Json", }); + internal_static_com_zpf_im_common_bean_msg_MessageResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_com_zpf_im_common_bean_msg_MessageResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_zpf_im_common_bean_msg_MessageResponse_descriptor, + new java.lang.String[] { "Result", "Code", "Info", "Expose", "LastBlock", "BlockIndex", }); + internal_static_com_zpf_im_common_bean_msg_MessageNotification_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_com_zpf_im_common_bean_msg_MessageNotification_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_zpf_im_common_bean_msg_MessageNotification_descriptor, + new java.lang.String[] { "MsgType", "Sender", "Json", "Timestamp", }); + internal_static_com_zpf_im_common_bean_msg_Message_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_com_zpf_im_common_bean_msg_Message_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_zpf_im_common_bean_msg_Message_descriptor, + new java.lang.String[] { "Type", "Sequence", "SessionId", "LoginRequest", "LoginResponse", "MessageRequest", "MessageResponse", "Notification", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/chatClient/pom.xml b/chatClient/pom.xml new file mode 100644 index 0000000..461fc45 --- /dev/null +++ b/chatClient/pom.xml @@ -0,0 +1,23 @@ + + + + my_netty + com.zpf + 1.0-SNAPSHOT + + 4.0.0 + + chatClient + + + + com.zpf + chat + 1.0-SNAPSHOT + + + + + \ No newline at end of file diff --git a/chatClient/src/main/java/client/CommandClient.java b/chatClient/src/main/java/client/CommandClient.java new file mode 100644 index 0000000..08a8a03 --- /dev/null +++ b/chatClient/src/main/java/client/CommandClient.java @@ -0,0 +1,67 @@ +package client; + +import command.BaseCommand; +import command.LoginConsoleCommand; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Slf4j +@Data +@Service("CommandController") +public class CommandClient { + //聊天命令收集类 + + //登录命令收集类 + @Autowired + LoginConsoleCommand loginConsoleCommand; + + //登出命令收集类 + + //菜单命令收集类 + + + private Map commandMap; + + private String menuString; + + //会话类 + + private boolean connectFlag = false; + + + + //命令收集线程 + public void startCommandThread(){ + Thread.currentThread().setName("命令线程"); + + while (true){ + //建立连接 + while (connectFlag == false){ + //开始连接 + startConnectServer(); + waitCommandThread(); + } + + } + + + + + } + + private void waitCommandThread() { + + + } + + + private void startConnectServer() { + FutureTaskSchedu + } + + +} diff --git a/chatClient/src/main/java/command/BaseCommand.java b/chatClient/src/main/java/command/BaseCommand.java new file mode 100644 index 0000000..fe3ffa6 --- /dev/null +++ b/chatClient/src/main/java/command/BaseCommand.java @@ -0,0 +1,11 @@ +package command; + +import java.util.Scanner; + +public interface BaseCommand { + void exec(Scanner scanner); + + String getKey(); + + String getTip(); +} diff --git a/chatClient/src/main/java/command/LoginConsoleCommand.java b/chatClient/src/main/java/command/LoginConsoleCommand.java new file mode 100644 index 0000000..a755c21 --- /dev/null +++ b/chatClient/src/main/java/command/LoginConsoleCommand.java @@ -0,0 +1,42 @@ +package command; + +import lombok.Data; +import org.springframework.stereotype.Service; + +import java.util.Scanner; +@Data +@Service +public class LoginConsoleCommand implements BaseCommand { + public static final String KEY = "1"; + + private String userName; + private String password; + + @Override + public void exec(Scanner scanner) { + System.out.println("请输入用户信息(id:password)"); + String[] info = null; + + while (true){ + String input = scanner.next(); + info = input.split(":"); + if (info.length != 2){ + System.out.println("请按格式输入(id:password)"); + }else { + break; + } + } + userName = info[0]; + password = info[1]; + } + + @Override + public String getKey() { + return KEY; + } + + @Override + public String getTip() { + return "登录"; + } +} diff --git a/chatServer/pom.xml b/chatServer/pom.xml new file mode 100644 index 0000000..9ee3342 --- /dev/null +++ b/chatServer/pom.xml @@ -0,0 +1,32 @@ + + + + my_netty + com.zpf + 1.0-SNAPSHOT + + 4.0.0 + + chatServer + + + + com.zpf + chat + 1.0-SNAPSHOT + + + + + io.github.openfeign + feign-gson + 9.5.0 + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7c703c8..eccf1a2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,13 @@ com.zpf my_netty + pom 1.0-SNAPSHOT + + chat + chatClient + chatServer + UTF-8 -- Gitee From 201922565de2a658f2487c2b210f5a4a72f980ec Mon Sep 17 00:00:00 2001 From: pengfei Date: Wed, 18 Dec 2019 17:30:03 +0800 Subject: [PATCH 11/13] =?UTF-8?q?im=E4=B8=ADcommon=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zpf/im/common/ProtoInstant.java | 60 +++++++++++++ .../zpf/im/common/cocurrent/ExecuteTask.java | 7 ++ .../common/cocurrent/FutureTaskScheduler.java | 85 +++++++++++++++++++ .../zpf/im/common/codec/ProtobufDecoder.java | 4 + .../zpf/im/common/codec/ProtobufEncoder.java | 16 ++++ 5 files changed, 172 insertions(+) create mode 100644 chat/src/main/java/com/zpf/im/common/ProtoInstant.java create mode 100644 chat/src/main/java/com/zpf/im/common/cocurrent/ExecuteTask.java create mode 100644 chat/src/main/java/com/zpf/im/common/cocurrent/FutureTaskScheduler.java create mode 100644 chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java create mode 100644 chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java diff --git a/chat/src/main/java/com/zpf/im/common/ProtoInstant.java b/chat/src/main/java/com/zpf/im/common/ProtoInstant.java new file mode 100644 index 0000000..ce8c11c --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/ProtoInstant.java @@ -0,0 +1,60 @@ +package com.zpf.im.common; + +public class ProtoInstant { + /** + * 魔数 + */ + public static final short MAGIC_CODE = 0x86; + + /** + * 版本号 + */ + + public static final short VERSION_CODE = 0x01; + + /** + * 客户端平台 + */ + + public interface PlatForm{ + + public static final int WINDOWS = 1; + + public static final int MAC = 2; + + public static final int ANDROID = 3; + + public static final int IOS = 4; + + public static final int WEB = 5; + + public static final int UNKNOWN = 6; + } + + /** + * 返回枚举类 + */ + public enum ResultCodeEnum{ + SUCCESS(0,"登录成功"), + AUTH_FAILED(1,"登录失败"), + NO_TOKEN(2,"没有授权码"), + UNKNOW_ERROR(3,"未知错误") + ; + + private Integer code; + private String desc; + + ResultCodeEnum(Integer code,String desc){ + this.code = code; + this.desc = desc; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + } +} diff --git a/chat/src/main/java/com/zpf/im/common/cocurrent/ExecuteTask.java b/chat/src/main/java/com/zpf/im/common/cocurrent/ExecuteTask.java new file mode 100644 index 0000000..4ca77c9 --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/cocurrent/ExecuteTask.java @@ -0,0 +1,7 @@ +package com.zpf.im.common.cocurrent; + +public interface ExecuteTask { + + void execute(); + +} diff --git a/chat/src/main/java/com/zpf/im/common/cocurrent/FutureTaskScheduler.java b/chat/src/main/java/com/zpf/im/common/cocurrent/FutureTaskScheduler.java new file mode 100644 index 0000000..f692764 --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/cocurrent/FutureTaskScheduler.java @@ -0,0 +1,85 @@ +package com.zpf.im.common.cocurrent; + +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class FutureTaskScheduler extends Thread{ + + private ConcurrentLinkedQueue executeTaskQueue = new ConcurrentLinkedQueue<>(); + + private long sleepTime = 200; + + private ExecutorService pool = Executors.newFixedThreadPool(10); + + private static FutureTaskScheduler instance = new FutureTaskScheduler(); + + private FutureTaskScheduler(){ + this.start(); + } + + + public static void add(ExecuteTask task){ + instance.executeTaskQueue.add(task); + } + + + @Override + public void run() { + while (true){ + handleTask(); + threadSleep(sleepTime); + } + } + + private void threadSleep(long sleepTime) { + try{ + sleep(sleepTime); + }catch (Exception e){ + e.printStackTrace(); + } + + + } + + /** + * 处理任务对列 + */ + private void handleTask() { + try{ + ExecuteTask executeTask; + while (executeTaskQueue.peek() != null){ + executeTask = executeTaskQueue.poll(); + handleTask(executeTask); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + /** + * 执行任务操作 + * @param executeTask + */ + private void handleTask(ExecuteTask executeTask){ + pool.execute(new ExecuteRunnable(executeTask)); + + } + + + class ExecuteRunnable implements Runnable{ + ExecuteTask executeTask; + + ExecuteRunnable(ExecuteTask executeTask){ + this.executeTask = executeTask; + } + + @Override + public void run() { + executeTask.execute(); + } + } + + + +} diff --git a/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java b/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java new file mode 100644 index 0000000..69afa2b --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java @@ -0,0 +1,4 @@ +package com.zpf.im.common.codec; + +public class ProtobufDecoder { +} diff --git a/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java b/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java new file mode 100644 index 0000000..89f519a --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java @@ -0,0 +1,16 @@ +package com.zpf.im.common.codec; + +import com.zpf.im.common.ProtoInstant; +import com.zpf.im.common.bean.msg.ProtoMsg; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.MessageToByteEncoder; + +public class ProtobufEncoder extends MessageToByteEncoder { + @Override + protected void encode(ChannelHandlerContext ctx, ProtoMsg.Message msg, ByteBuf out) throws Exception { + out.writeShort(ProtoInstant.MAGIC_CODE); + out.writeShort(ProtoInstant.VERSION_CODE); + + } +} -- Gitee From b7d554eb035062207adbde665416cf8eb6031a1f Mon Sep 17 00:00:00 2001 From: pengfei Date: Thu, 19 Dec 2019 17:04:45 +0800 Subject: [PATCH 12/13] =?UTF-8?q?im=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat/pom.xml | 2 +- .../java/com/zpf/im/common/bean/msg/User.java | 49 +++++++ .../zpf/im/common/codec/ProtobufDecoder.java | 66 ++++++++- .../zpf/im/common/codec/ProtobufEncoder.java | 12 ++ .../imClient/client/ClientApplication.java | 28 ++++ .../zpf/imClient/client/ClientSession.java | 134 ++++++++++++++++++ .../zpf/imClient}/client/CommandClient.java | 31 +++- .../com/zpf/imClient/client/NettyClient.java | 74 ++++++++++ .../zpf/imClient}/command/BaseCommand.java | 2 +- .../imClient/command/ChatConsoleCommand.java | 46 ++++++ .../imClient/command/ClientCommandMenu.java | 39 +++++ .../command/LoginConsoleCommand.java | 3 +- .../command/LogoutConsoleCommand.java | 28 ++++ .../com/zpf/imClient/sender/BaseSender.java | 57 ++++++++ pom.xml | 2 +- .../java/com/zpf/three/nio/NioSendClient.java | 2 +- 16 files changed, 565 insertions(+), 10 deletions(-) create mode 100644 chat/src/main/java/com/zpf/im/common/bean/msg/User.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/client/ClientApplication.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java rename chatClient/src/main/java/{ => com/zpf/imClient}/client/CommandClient.java (62%) create mode 100644 chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java rename chatClient/src/main/java/{ => com/zpf/imClient}/command/BaseCommand.java (80%) create mode 100644 chatClient/src/main/java/com/zpf/imClient/command/ChatConsoleCommand.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/command/ClientCommandMenu.java rename chatClient/src/main/java/{ => com/zpf/imClient}/command/LoginConsoleCommand.java (91%) create mode 100644 chatClient/src/main/java/com/zpf/imClient/command/LogoutConsoleCommand.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java diff --git a/chat/pom.xml b/chat/pom.xml index 67c4239..f0a6fde 100644 --- a/chat/pom.xml +++ b/chat/pom.xml @@ -72,7 +72,7 @@ org.apache.curator - curator-client + curator-com.zpf.imClient.command.client 4.0.0 diff --git a/chat/src/main/java/com/zpf/im/common/bean/msg/User.java b/chat/src/main/java/com/zpf/im/common/bean/msg/User.java new file mode 100644 index 0000000..be0a702 --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/bean/msg/User.java @@ -0,0 +1,49 @@ +package com.zpf.im.common.bean.msg; + +public class User { + String uid; + String devId; + String token; + String nickName = "nickName"; + PLATTYPE platForm = PLATTYPE.WINDOWS; + + + public enum PLATTYPE { + WINDOWS, MAC, ANDROID, IOS, WEB, OTHER; + } + + + private String sessionId; + + public void setPlatform(int platForm) { + PLATTYPE[] values = PLATTYPE.values(); + for (int i = 0; i < values.length; i++) { + if (values[i].ordinal() == platForm) { + this.platForm = values[i]; + } + } + } + + + @Override + public String toString() { + return "User{" + + "uid='" + uid + '\'' + + ", devId='" + devId + '\'' + + ", token='" + token + '\'' + + ", nickName='" + nickName + '\'' + + ", platForm=" + platForm + + ", sessionId='" + sessionId + '\'' + + '}'; + } + + public static User fromMsg(ProtoMsg.LoginRequest info){ + User user = new User(); + user.uid = new String(info.getUid()); + user.token = new String(info.getToken()); + user.setPlatform(info.getPlatform()); + System.out.println("登录中===>"+user.nickName); + return user; + } + +} diff --git a/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java b/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java index 69afa2b..38e4b28 100644 --- a/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java +++ b/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java @@ -1,4 +1,68 @@ package com.zpf.im.common.codec; -public class ProtobufDecoder { +import com.zpf.im.common.ProtoInstant; +import com.zpf.im.common.bean.msg.ProtoMsg; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.ByteToMessageDecoder; + +import java.util.List; + +public class ProtobufDecoder extends ByteToMessageDecoder { + + @Override + protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { + + //标记一下当前的readIndex的位置 + in.markReaderIndex(); + + //判断包头长度 + if (in.readableBytes() < 8){//不够包头 + return; + } + + short magic = in.readShort(); + if (magic != ProtoInstant.MAGIC_CODE){ + String error = "客户端口令不对:"+ctx.channel().remoteAddress(); + throw new Exception(error); + } + + //读取版本 + short version = in.readShort(); + //读取消息长度 + int length = in.readInt(); + + if (length < 0){ + ctx.close(); + } + + //读到的消息体长度小于传过来的消息体长度 + if(length > in.readableBytes()){ + //重置读取位置 + in.resetReaderIndex(); + return; + } + + + + byte[] array; + if (in.hasArray()){ + //堆缓冲区 + ByteBuf slice = in.slice(); + array = slice.array(); + }else { + //直接缓冲 + array = new byte[length]; + in.readBytes(array,0,length); + } + + //字节转换成对象 + ProtoMsg.Message outMsg = ProtoMsg.Message.parseFrom(array); + + if (outMsg != null){ + out.add(outMsg); + } + + + } } diff --git a/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java b/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java index 89f519a..d5d2b46 100644 --- a/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java +++ b/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java @@ -12,5 +12,17 @@ public class ProtobufEncoder extends MessageToByteEncoder { out.writeShort(ProtoInstant.MAGIC_CODE); out.writeShort(ProtoInstant.VERSION_CODE); + byte[] bytes = msg.toByteArray(); + + + int length = bytes.length; + + //消息长度写入 + out.writeInt(length); + + //消息体重包含要发送的数据 + out.writeBytes(bytes); + + } } diff --git a/chatClient/src/main/java/com/zpf/imClient/client/ClientApplication.java b/chatClient/src/main/java/com/zpf/imClient/client/ClientApplication.java new file mode 100644 index 0000000..bf7eb44 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/client/ClientApplication.java @@ -0,0 +1,28 @@ +package com.zpf.imClient.client; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableAutoConfiguration +@ComponentScan("com.zpf.imClient") +public class ClientApplication { + + public static void main(String[] args) { + ApplicationContext context = SpringApplication.run(ClientApplication.class, args); + CommandClient commandClient = context.getBean(CommandClient.class); + + commandClient.initCommandMap(); + + try{ + commandClient.startCommandThread(); + }catch (Exception e){ + e.printStackTrace(); + } + + + } +} diff --git a/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java b/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java new file mode 100644 index 0000000..1f56414 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java @@ -0,0 +1,134 @@ +package com.zpf.imClient.client; + +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.im.common.bean.msg.User; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import io.netty.util.AttributeKey; +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class ClientSession { + + public static final AttributeKey SESSION_KEY = + AttributeKey.valueOf("SESSION_KEY"); + + /** + * 用户实现客户端回话管理的核心 + */ + private Channel channel; + private User user; + + + private String sessionId; + + + public boolean isConnected = false; + public boolean isLogin = false; + + + /** + * session中存储的session变量属性值 + */ + private Map map = new HashMap<>(); + + //绑定通道 + public ClientSession (Channel channel){ + this.channel = channel; + this.sessionId = String.valueOf(-1); + channel.attr(ClientSession.SESSION_KEY).set(this); + } + + + + //登录成功之后,设置sessionId + public static void loginSuccess(ChannelHandlerContext ctx, ProtoMsg.Message pkg){ + Channel channel = ctx.channel(); + ClientSession clientSession = channel.attr(ClientSession.SESSION_KEY).get(); + clientSession.sessionId = pkg.getSessionId(); + clientSession.isLogin = true; + System.out.println("登录成功"); + } + + + + //获取channel + public static ClientSession getSession(ChannelHandlerContext ctx){ + Channel channel = ctx.channel(); + ClientSession session = channel.attr(ClientSession.SESSION_KEY).get(); + return session; + } + + + + + public String getRemoteAddress(){ + return channel.remoteAddress().toString(); + } + + //写protobuf 数据帧 + public ChannelFuture writeAndFlush(Object pkg){ + ChannelFuture future = channel.writeAndFlush(pkg); + return future; + } + + + public void writeAndClose(Object pkg){ + ChannelFuture future = channel.writeAndFlush(pkg); + future.addListener(ChannelFutureListener.CLOSE); + } + + + //关闭通道 + public void close(){ + isConnected = false; + + ChannelFuture future = channel.close(); + future.addListener(new ChannelFutureListener() { + @Override + public void operationComplete(ChannelFuture future) throws Exception { + if (future.isSuccess()){ + System.out.println("连接顺利断开"); + } + } + }); + + + + + + + + + + + + } + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/chatClient/src/main/java/client/CommandClient.java b/chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java similarity index 62% rename from chatClient/src/main/java/client/CommandClient.java rename to chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java index 08a8a03..c3b5d53 100644 --- a/chatClient/src/main/java/client/CommandClient.java +++ b/chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java @@ -1,12 +1,13 @@ -package client; +package com.zpf.imClient.client; -import command.BaseCommand; -import command.LoginConsoleCommand; +import com.zpf.imClient.command.*; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.nio.channels.Channel; +import java.util.HashMap; import java.util.Map; @Slf4j @@ -14,26 +15,44 @@ import java.util.Map; @Service("CommandController") public class CommandClient { //聊天命令收集类 + @Autowired + ChatConsoleCommand chatConsoleCommand; //登录命令收集类 @Autowired LoginConsoleCommand loginConsoleCommand; //登出命令收集类 + @Autowired + LogoutConsoleCommand logoutConsoleCommand; //菜单命令收集类 - + @Autowired + ClientCommandMenu clientCommandMenu; private Map commandMap; private String menuString; //会话类 + private ClientSession session; + + @Autowired + private NettyClient nettyClient; + + private Channel channel; + + @Autowired + private ChatSender chatSender; private boolean connectFlag = false; + private Map commandMap; + + + //命令收集线程 public void startCommandThread(){ Thread.currentThread().setName("命令线程"); @@ -64,4 +83,8 @@ public class CommandClient { } + public void initCommandMap() { + commandMap = new HashMap<>(); + commandMap.put() + } } diff --git a/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java b/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java new file mode 100644 index 0000000..8065f1c --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java @@ -0,0 +1,74 @@ +package com.zpf.imClient.client; + +import com.zpf.im.common.codec.ProtobufDecoder; +import com.zpf.im.common.codec.ProtobufEncoder; +import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.PooledByteBufAllocator; +import io.netty.channel.*; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioSocketChannel; +import io.netty.util.concurrent.GenericFutureListener; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + + +@Service("NettyClient") +public class NettyClient { + + @Value("${server.ip}") + private String host; + @Value("${server.port}") + private int port; + + + private Channel channel; +// private ChatSender sender; + + + private boolean initFlag = true; + //private User + private GenericFutureListener connectedListener; + + private Bootstrap b; + private EventLoopGroup g; + + + public NettyClient() { + g = new NioEventLoopGroup(); + } + + /** + * 重连 + */ + public void doConnect() { + + try { + b = new Bootstrap(); + + b.group(g); + b.channel(NioSocketChannel.class).option(ChannelOption.SO_KEEPALIVE,true) + .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); + b.remoteAddress(host,port); + + b.handler(new ChannelInitializer() { + @Override + protected void initChannel(SocketChannel ch) throws Exception { + ch.pipeline().addLast("decoder",new ProtobufDecoder()) + .addLast("encoder",new ProtobufEncoder()) + .add + } + }); + + + + + } catch (Exception e) { + e.printStackTrace(); + } + + + } + + +} diff --git a/chatClient/src/main/java/command/BaseCommand.java b/chatClient/src/main/java/com/zpf/imClient/command/BaseCommand.java similarity index 80% rename from chatClient/src/main/java/command/BaseCommand.java rename to chatClient/src/main/java/com/zpf/imClient/command/BaseCommand.java index fe3ffa6..7ea7311 100644 --- a/chatClient/src/main/java/command/BaseCommand.java +++ b/chatClient/src/main/java/com/zpf/imClient/command/BaseCommand.java @@ -1,4 +1,4 @@ -package command; +package com.zpf.imClient.command; import java.util.Scanner; diff --git a/chatClient/src/main/java/com/zpf/imClient/command/ChatConsoleCommand.java b/chatClient/src/main/java/com/zpf/imClient/command/ChatConsoleCommand.java new file mode 100644 index 0000000..a23daef --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/command/ChatConsoleCommand.java @@ -0,0 +1,46 @@ +package com.zpf.imClient.command; + +import com.zpf.imClient.command.BaseCommand; +import lombok.Data; +import org.springframework.stereotype.Service; + +import java.util.Scanner; + +@Data +@Service("ChatConsoleCommand") +public class ChatConsoleCommand implements BaseCommand { + + private String toUserId; + private String message; + public static final String KEY = "2"; + + @Override + public void exec(Scanner scanner) { + System.out.print("请输入聊天的消息(id:message):"); + String[] info = null; + while (true) { + String input = scanner.next(); + info = input.split(":"); + if (info.length != 2) { + System.out.println("请输入聊天的消息(id:message):"); + } else { + break; + } + } + toUserId = info[0]; + message = info[1]; + } + + + @Override + public String getKey() { + return KEY; + } + + @Override + public String getTip() { + return "聊天"; + } + +} + diff --git a/chatClient/src/main/java/com/zpf/imClient/command/ClientCommandMenu.java b/chatClient/src/main/java/com/zpf/imClient/command/ClientCommandMenu.java new file mode 100644 index 0000000..cd366a8 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/command/ClientCommandMenu.java @@ -0,0 +1,39 @@ +package com.zpf.imClient.command; + +import lombok.Data; +import org.springframework.stereotype.Service; + +import java.util.Scanner; + +@Data +@Service("ClientCommandMenu") +public class ClientCommandMenu implements BaseCommand { + + public static final String KEY = "0"; + + private String allCommandsShow; + private String commandInput; + + @Override + public void exec(Scanner scanner) { + + System.err.println("请输入某个操作指令:"); + System.err.println(allCommandsShow); + // 获取第一个指令 + commandInput = scanner.next(); + + + } + + + @Override + public String getKey() { + return KEY; + } + + @Override + public String getTip() { + return "show 所有命令"; + } + +} diff --git a/chatClient/src/main/java/command/LoginConsoleCommand.java b/chatClient/src/main/java/com/zpf/imClient/command/LoginConsoleCommand.java similarity index 91% rename from chatClient/src/main/java/command/LoginConsoleCommand.java rename to chatClient/src/main/java/com/zpf/imClient/command/LoginConsoleCommand.java index a755c21..f5e45e1 100644 --- a/chatClient/src/main/java/command/LoginConsoleCommand.java +++ b/chatClient/src/main/java/com/zpf/imClient/command/LoginConsoleCommand.java @@ -1,5 +1,6 @@ -package command; +package com.zpf.imClient.command; +import com.zpf.imClient.command.BaseCommand; import lombok.Data; import org.springframework.stereotype.Service; diff --git a/chatClient/src/main/java/com/zpf/imClient/command/LogoutConsoleCommand.java b/chatClient/src/main/java/com/zpf/imClient/command/LogoutConsoleCommand.java new file mode 100644 index 0000000..56e1754 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/command/LogoutConsoleCommand.java @@ -0,0 +1,28 @@ +package com.zpf.imClient.command; + +import com.zpf.imClient.command.BaseCommand; +import org.springframework.stereotype.Service; + +import java.util.Scanner; + +@Service("LogoutConsoleCommand") +public class LogoutConsoleCommand implements BaseCommand { + public static final String KEY = "10"; + + @Override + public void exec(Scanner scanner) { + + } + + + @Override + public String getKey() { + return KEY; + } + + @Override + public String getTip() { + return "退出"; + } + +} diff --git a/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java b/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java new file mode 100644 index 0000000..bf0821b --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java @@ -0,0 +1,57 @@ +package com.zpf.imClient.sender; + +import com.zpf.im.common.bean.msg.User; +import com.zpf.imClient.client.ClientSession; +import lombok.Data; + +@Data +public abstract class BaseSender { + private User user; + private ClientSession session; + + public boolean isConnected(){ + if (null == session){ + System.out.println("session is null" ); + return false; + } + return session.isConnected; + } + + + public boolean isLogin(){ + if (null == session){ + return false; + } + return session.isLogin; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/pom.xml b/pom.xml index eccf1a2..077a9fa 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ org.apache.curator - curator-client + curator-com.zpf.imClient.command.client 4.0.0 diff --git a/src/main/java/com/zpf/three/nio/NioSendClient.java b/src/main/java/com/zpf/three/nio/NioSendClient.java index 483b325..2a6c463 100644 --- a/src/main/java/com/zpf/three/nio/NioSendClient.java +++ b/src/main/java/com/zpf/three/nio/NioSendClient.java @@ -37,7 +37,7 @@ public class NioSendClient { SocketChannel socketChannel = SocketChannel.open(); socketChannel.socket().connect(new InetSocketAddress(NioDemoConfig.SOCKET_SERVER_IP,NioDemoConfig.SOCKET_SERVER_PORT)); socketChannel.configureBlocking(false); - Logger.debug("client 成功连接服务器"); + Logger.debug("com.zpf.imClient.command.client 成功连接服务器"); while (!socketChannel.finishConnect()){ Logger.debug("自旋中"); -- Gitee From 022a921ee85a5bc0f4813e1f55b3e45e0cbc497d Mon Sep 17 00:00:00 2001 From: pengfei Date: Fri, 20 Dec 2019 14:19:56 +0800 Subject: [PATCH 13/13] =?UTF-8?q?im=E5=BC=80=E5=8F=91client=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zpf/im/common/ProtoInstant.java | 9 +++ .../com/zpf/im/common/bean/msg/ChatMsg.java | 78 +++++++++++++++++++ .../java/com/zpf/im/common/bean/msg/User.java | 3 + .../zpf/im/common/codec/ProtobufDecoder.java | 1 - .../zpf/im/common/codec/ProtobufEncoder.java | 1 - .../exception/InvalidFrameException.java | 11 +++ .../zpf/imClient/client/ClientSession.java | 6 +- .../zpf/imClient/client/CommandClient.java | 3 +- .../com/zpf/imClient/client/NettyClient.java | 40 ++++++++-- .../zpf/imClient/handler/ChatMsgHandler.java | 42 ++++++++++ .../imClient/handler/ExceptionHandler.java | 50 ++++++++++++ .../handler/HeartBeatClientHandler.java | 78 +++++++++++++++++++ .../handler/LoginResponceHandler.java | 55 +++++++++++++ .../imClient/protoBuilder/BaseBuilder.java | 37 +++++++++ .../imClient/protoBuilder/ChatMsgBuilder.java | 54 +++++++++++++ .../protoBuilder/HeartBeatMsgBuilder.java | 36 +++++++++ .../protoBuilder/LoginMsgBuilder.java | 43 ++++++++++ .../com/zpf/imClient/sender/BaseSender.java | 50 +++++++----- .../com/zpf/imClient/sender/ChatSender.java | 36 +++++++++ .../com/zpf/imClient/sender/LoginSender.java | 31 ++++++++ 20 files changed, 632 insertions(+), 32 deletions(-) create mode 100644 chat/src/main/java/com/zpf/im/common/bean/msg/ChatMsg.java create mode 100644 chat/src/main/java/com/zpf/im/common/exception/InvalidFrameException.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/handler/ChatMsgHandler.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/handler/ExceptionHandler.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/handler/HeartBeatClientHandler.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/handler/LoginResponceHandler.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/protoBuilder/BaseBuilder.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/protoBuilder/ChatMsgBuilder.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/protoBuilder/HeartBeatMsgBuilder.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/protoBuilder/LoginMsgBuilder.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/sender/ChatSender.java create mode 100644 chatClient/src/main/java/com/zpf/imClient/sender/LoginSender.java diff --git a/chat/src/main/java/com/zpf/im/common/ProtoInstant.java b/chat/src/main/java/com/zpf/im/common/ProtoInstant.java index ce8c11c..4bd0e78 100644 --- a/chat/src/main/java/com/zpf/im/common/ProtoInstant.java +++ b/chat/src/main/java/com/zpf/im/common/ProtoInstant.java @@ -56,5 +56,14 @@ public class ProtoInstant { public void setCode(Integer code) { this.code = code; } + + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } } } diff --git a/chat/src/main/java/com/zpf/im/common/bean/msg/ChatMsg.java b/chat/src/main/java/com/zpf/im/common/bean/msg/ChatMsg.java new file mode 100644 index 0000000..9974248 --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/bean/msg/ChatMsg.java @@ -0,0 +1,78 @@ +package com.zpf.im.common.bean.msg; + +import lombok.Data; +import org.apache.commons.lang.StringUtils; + +@Data +public class ChatMsg { + + + //消息类型 1:纯文本 2:音频 3:视频 4:地理位置 5:其他 + public enum MSGTYPE { + TEXT, + AUDIO, + VIDEO, + POS, + OTHER; + } + + public ChatMsg(User user) { + if (null == user) { + return; + } + this.user = user; + this.setTime(System.currentTimeMillis()); + this.setFrom(user.getUid()); + this.setFromNick(user.getNickName()); + + } + + private User user; + + private long msgId; + private String from; + private String to; + private long time; + private MSGTYPE msgType; + private String content; + private String url; //多媒体地址 + private String property; //附加属性 + private String fromNick; //发送者昵称 + private String json; //附加的json串 + + + public void fillMsg(ProtoMsg.MessageRequest.Builder cb) { + if (msgId > 0) { + cb.setMsgId(msgId); + } + if (StringUtils.isNotEmpty(from)) { + cb.setFrom(from); + } + if (StringUtils.isNotEmpty(to)) { + cb.setTo(to); + } + if (time > 0) { + cb.setTime(time); + } + if (msgType != null) { + cb.setMsgType(msgType.ordinal()); + } + if (StringUtils.isNotEmpty(content)) { + cb.setContent(content); + } + if (StringUtils.isNotEmpty(url)) { + cb.setUrl(url); + } + if (StringUtils.isNotEmpty(property)) { + cb.setProperty(property); + } + if (StringUtils.isNotEmpty(fromNick)) { + cb.setFromNick(fromNick); + } + + if (StringUtils.isNotEmpty(json)) { + cb.setJson(json); + } + } + +} diff --git a/chat/src/main/java/com/zpf/im/common/bean/msg/User.java b/chat/src/main/java/com/zpf/im/common/bean/msg/User.java index be0a702..7c6e3aa 100644 --- a/chat/src/main/java/com/zpf/im/common/bean/msg/User.java +++ b/chat/src/main/java/com/zpf/im/common/bean/msg/User.java @@ -1,5 +1,8 @@ package com.zpf.im.common.bean.msg; +import lombok.Data; + +@Data public class User { String uid; String devId; diff --git a/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java b/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java index 38e4b28..c72b744 100644 --- a/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java +++ b/chat/src/main/java/com/zpf/im/common/codec/ProtobufDecoder.java @@ -1,7 +1,6 @@ package com.zpf.im.common.codec; import com.zpf.im.common.ProtoInstant; -import com.zpf.im.common.bean.msg.ProtoMsg; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ByteToMessageDecoder; diff --git a/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java b/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java index d5d2b46..990e175 100644 --- a/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java +++ b/chat/src/main/java/com/zpf/im/common/codec/ProtobufEncoder.java @@ -1,7 +1,6 @@ package com.zpf.im.common.codec; import com.zpf.im.common.ProtoInstant; -import com.zpf.im.common.bean.msg.ProtoMsg; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; diff --git a/chat/src/main/java/com/zpf/im/common/exception/InvalidFrameException.java b/chat/src/main/java/com/zpf/im/common/exception/InvalidFrameException.java new file mode 100644 index 0000000..9622e98 --- /dev/null +++ b/chat/src/main/java/com/zpf/im/common/exception/InvalidFrameException.java @@ -0,0 +1,11 @@ +package com.zpf.im.common.exception; + +public class InvalidFrameException extends Exception { + + + public InvalidFrameException(String s) { + super(s); + } + + +} diff --git a/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java b/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java index 1f56414..48a927e 100644 --- a/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java +++ b/chatClient/src/main/java/com/zpf/imClient/client/ClientSession.java @@ -7,12 +7,14 @@ import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.util.AttributeKey; -import lombok.Data; +import lombok.Getter; +import lombok.Setter; import java.util.HashMap; import java.util.Map; -@Data +@Getter +@Setter public class ClientSession { public static final AttributeKey SESSION_KEY = diff --git a/chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java b/chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java index c3b5d53..b23c964 100644 --- a/chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java +++ b/chatClient/src/main/java/com/zpf/imClient/client/CommandClient.java @@ -1,6 +1,7 @@ package com.zpf.imClient.client; import com.zpf.imClient.command.*; +import com.zpf.imClient.sender.ChatSender; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -78,7 +79,7 @@ public class CommandClient { } - private void startConnectServer() { + public void startConnectServer() { FutureTaskSchedu } diff --git a/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java b/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java index 8065f1c..7d9dbdd 100644 --- a/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java +++ b/chatClient/src/main/java/com/zpf/imClient/client/NettyClient.java @@ -1,7 +1,13 @@ package com.zpf.imClient.client; +import com.zpf.im.common.bean.msg.User; import com.zpf.im.common.codec.ProtobufDecoder; import com.zpf.im.common.codec.ProtobufEncoder; +import com.zpf.imClient.handler.ChatMsgHandler; +import com.zpf.imClient.handler.ExceptionHandler; +import com.zpf.imClient.handler.LoginResponceHandler; +import com.zpf.imClient.sender.ChatSender; +import com.zpf.imClient.sender.LoginSender; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.PooledByteBufAllocator; import io.netty.channel.*; @@ -9,10 +15,13 @@ import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.util.concurrent.GenericFutureListener; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; - - +@Slf4j +@Data @Service("NettyClient") public class NettyClient { @@ -22,12 +31,25 @@ public class NettyClient { private int port; + @Autowired + private ChatMsgHandler chatMsgHandler; + + @Autowired + private LoginResponceHandler loginResponceHandler; + + @Autowired + private ExceptionHandler exceptionHandler; + + + private Channel channel; -// private ChatSender sender; + private ChatSender chatSender; + private LoginSender loginSender; + private boolean initFlag = true; - //private User + private User user; private GenericFutureListener connectedListener; private Bootstrap b; @@ -56,12 +78,18 @@ public class NettyClient { protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast("decoder",new ProtobufDecoder()) .addLast("encoder",new ProtobufEncoder()) - .add + .addLast(loginResponceHandler) + .addLast(chatMsgHandler) + .addLast(exceptionHandler); } }); + log.info("客户端开始连接"); + ChannelFuture future = b.connect(); + future.addListener(connectedListener); - + // + future.channel().closeFuture().await(); } catch (Exception e) { e.printStackTrace(); diff --git a/chatClient/src/main/java/com/zpf/imClient/handler/ChatMsgHandler.java b/chatClient/src/main/java/com/zpf/imClient/handler/ChatMsgHandler.java new file mode 100644 index 0000000..1108fb2 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/handler/ChatMsgHandler.java @@ -0,0 +1,42 @@ +package com.zpf.imClient.handler; + +import com.zpf.im.common.bean.msg.ProtoMsg; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import org.springframework.stereotype.Component; + +@ChannelHandler.Sharable +@Component("ChatMsgHandler") +public class ChatMsgHandler extends ChannelInboundHandlerAdapter { + public ChatMsgHandler(){ + + } + + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if (null == msg || !(msg instanceof ProtoMsg.Message)){ + super.channelRead(ctx,msg); + //ctx.fireChannelRead(msg); + return; + } + + + + ProtoMsg.Message pkg = (ProtoMsg.Message) msg; + ProtoMsg.HeadType headType = pkg.getType(); + if (!headType.equals(ProtoMsg.HeadType.MESSAGE_REQUEST)){ + super.channelRead(ctx,msg); + return; + } + + + ProtoMsg.MessageRequest req = pkg.getMessageRequest(); + String content = req.getContent(); + String uid= req.getFrom(); + + System.out.println("收到消息从 uid:"+uid+"-->"+content); + + } +} diff --git a/chatClient/src/main/java/com/zpf/imClient/handler/ExceptionHandler.java b/chatClient/src/main/java/com/zpf/imClient/handler/ExceptionHandler.java new file mode 100644 index 0000000..e23c20a --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/handler/ExceptionHandler.java @@ -0,0 +1,50 @@ +package com.zpf.imClient.handler; + +import com.zpf.im.common.exception.InvalidFrameException; +import com.zpf.imClient.client.ClientSession; +import com.zpf.imClient.client.CommandClient; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Slf4j +@ChannelHandler.Sharable +@Component("ExceptionHandler") +public class ExceptionHandler extends ChannelInboundHandlerAdapter { + + + @Autowired + private CommandClient commandClient; + + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + if (cause instanceof InvalidFrameException){ + log.error(cause.getMessage()); + ClientSession.getSession(ctx).close(); + }else { + //捕捉异常信息 + log.error(cause.getMessage()); + ctx.close(); + + + //重连 + commandClient.setConnectFlag(false); + commandClient.startConnectServer(); + } + } + + /** + * 通道 read 读取 complete 完成 + * 刷洗 flush + * @param ctx + * @throws Exception + */ + @Override + public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { + ctx.flush(); + } +} diff --git a/chatClient/src/main/java/com/zpf/imClient/handler/HeartBeatClientHandler.java b/chatClient/src/main/java/com/zpf/imClient/handler/HeartBeatClientHandler.java new file mode 100644 index 0000000..63eee25 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/handler/HeartBeatClientHandler.java @@ -0,0 +1,78 @@ +package com.zpf.imClient.handler; + +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.im.common.bean.msg.User; +import com.zpf.imClient.client.ClientSession; +import com.zpf.imClient.protoBuilder.HeartBeatMsgBuilder; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +@Slf4j +@Component("HeartBeatClientHandler") +@ChannelHandler.Sharable +public class HeartBeatClientHandler extends ChannelInboundHandlerAdapter { + + //心跳时间间隔 s + private static final int HEART_INTERVAL = 100; + + + //handler被添加到pipline时,开始发送心跳 + @Override + public void handlerAdded(ChannelHandlerContext ctx) throws Exception { + ClientSession session = ClientSession.getSession(ctx); + User user = session.getUser(); + HeartBeatMsgBuilder builder = new HeartBeatMsgBuilder(user, session); + + ProtoMsg.Message message = builder.buildMsg(); + //发送心跳 + heartBeat(ctx, message); + } + + //使用定时器,发送心跳报文 + private void heartBeat(ChannelHandlerContext ctx, ProtoMsg.Message message) { + ctx.executor().schedule(new Runnable() { + @Override + public void run() { + if (ctx.channel().isActive()) { + log.info("发送 HEART_BEAT 消息到 server"); + ctx.writeAndFlush(message); + + //递归调用 + heartBeat(ctx, message); + } + } + }, HEART_INTERVAL, TimeUnit.SECONDS); + } + + //接受到服务器的心跳回写 + + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + + if (null == msg || !(msg instanceof ProtoMsg.Message)) { + super.channelRead(ctx, msg); + return; + } + + + //判断类型 + ProtoMsg.Message pkg = (ProtoMsg.Message) msg; + + ProtoMsg.HeadType headType = pkg.getType(); + + if (headType.equals(ProtoMsg.HeadType.HEART_BEAT)) { + log.info("收到回写的 HEART_BEAT 消息 从 server"); + return; + } else { + super.channelRead(ctx, msg); + } + + + } +} diff --git a/chatClient/src/main/java/com/zpf/imClient/handler/LoginResponceHandler.java b/chatClient/src/main/java/com/zpf/imClient/handler/LoginResponceHandler.java new file mode 100644 index 0000000..2dc96fb --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/handler/LoginResponceHandler.java @@ -0,0 +1,55 @@ +package com.zpf.imClient.handler; + +import com.zpf.im.common.ProtoInstant; +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.imClient.client.ClientSession; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.ChannelPipeline; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Slf4j +@ChannelHandler.Sharable +@Component("LoginResponceHandler") +public class LoginResponceHandler extends ChannelInboundHandlerAdapter { + + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if (null == msg || !(msg instanceof ProtoMsg.Message)){ + super.channelRead(ctx,msg); + return; + } + + //判断类型 + ProtoMsg.Message pkg = (ProtoMsg.Message) msg; + ProtoMsg.HeadType headType = ((ProtoMsg.Message) msg).getType(); + if (!headType.equals(ProtoMsg.HeadType.LOGIN_RESPONSE)){ + super.channelRead(ctx,msg); + return; + } + + + + //判断返回是否成功 + ProtoMsg.LoginResponse info = pkg.getLoginResponse(); + ProtoInstant.ResultCodeEnum result = ProtoInstant.ResultCodeEnum.values()[info.getCode()]; + if (!result.equals(ProtoInstant.ResultCodeEnum.SUCCESS)){ + log.info(result.getDesc()); + }else { + //登录成功 + ClientSession.loginSuccess(ctx,pkg); + ChannelPipeline p = ctx.pipeline(); + + //移除登录响应handler + p.remove(this); + + //动态插入心跳处理器 + p.addAfter("encoder","heartbeat",new HeartBeatClientHandler()); + } + + + } +} diff --git a/chatClient/src/main/java/com/zpf/imClient/protoBuilder/BaseBuilder.java b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/BaseBuilder.java new file mode 100644 index 0000000..99849c9 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/BaseBuilder.java @@ -0,0 +1,37 @@ +package com.zpf.imClient.protoBuilder; + + +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.imClient.client.ClientSession; + +/** + * 基础 Builder + * + * @author 尼恩 at 疯狂创客圈 + */ +public class BaseBuilder { + protected ProtoMsg.HeadType type; + private long seqId; + private ClientSession session; + + public BaseBuilder(ProtoMsg.HeadType type, ClientSession session) { + this.type = type; + this.session = session; + } + + /** + * 构建消息 基础部分 + */ + public ProtoMsg.Message buildCommon(long seqId) { + this.seqId = seqId; + + ProtoMsg.Message.Builder mb = + ProtoMsg.Message + .newBuilder() + .setType(type) + .setSessionId(session.getSessionId()) + .setSequence(seqId); + return mb.buildPartial(); + } + +} diff --git a/chatClient/src/main/java/com/zpf/imClient/protoBuilder/ChatMsgBuilder.java b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/ChatMsgBuilder.java new file mode 100644 index 0000000..7003ba1 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/ChatMsgBuilder.java @@ -0,0 +1,54 @@ +/** + * Created by 尼恩 at 疯狂创客圈 + */ + +package com.zpf.imClient.protoBuilder; + + +import com.zpf.im.common.bean.msg.ChatMsg; +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.im.common.bean.msg.ProtoMsg.HeadType; +import com.zpf.im.common.bean.msg.User; +import com.zpf.imClient.client.ClientSession; + +/** + * 聊天消息Builder + */ + +public class ChatMsgBuilder extends BaseBuilder { + + + private ChatMsg chatMsg; + private User user; + + + public ChatMsgBuilder(ChatMsg chatMsg, User user, ClientSession session) { + super(HeadType.MESSAGE_REQUEST, session); + this.chatMsg = chatMsg; + this.user = user; + + } + + + public ProtoMsg.Message build() { + ProtoMsg.Message message = buildCommon(-1); + ProtoMsg.MessageRequest.Builder cb + = ProtoMsg.MessageRequest.newBuilder(); + + chatMsg.fillMsg(cb); + return message + .toBuilder() + .setMessageRequest(cb) + .build(); + } + + public static ProtoMsg.Message buildChatMsg( + ChatMsg chatMsg, + User user, + ClientSession session) { + ChatMsgBuilder builder = + new ChatMsgBuilder(chatMsg, user, session); + return builder.build(); + + } +} \ No newline at end of file diff --git a/chatClient/src/main/java/com/zpf/imClient/protoBuilder/HeartBeatMsgBuilder.java b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/HeartBeatMsgBuilder.java new file mode 100644 index 0000000..9689509 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/HeartBeatMsgBuilder.java @@ -0,0 +1,36 @@ +/** + * Created by 尼恩 at 疯狂创客圈 + */ + +package com.zpf.imClient.protoBuilder; + + +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.im.common.bean.msg.User; +import com.zpf.imClient.client.ClientSession; + +/** + * 心跳消息Builder + */ +public class HeartBeatMsgBuilder extends BaseBuilder { + private final User user; + + public HeartBeatMsgBuilder(User user, ClientSession session) { + super(ProtoMsg.HeadType.HEART_BEAT, session); + this.user = user; + } + + public ProtoMsg.Message buildMsg() { + ProtoMsg.Message message = buildCommon(-1); + ProtoMsg.MessageNotification.Builder lb = + ProtoMsg.MessageHeartBeat.newBuilder() + .setSeq(0) + .setJson("{\"from\":\"client\"}") + .setUid(user.getUid()); + return message.toBuilder().setHeartBeat(lb).build(); + } + + +} + + diff --git a/chatClient/src/main/java/com/zpf/imClient/protoBuilder/LoginMsgBuilder.java b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/LoginMsgBuilder.java new file mode 100644 index 0000000..6d0abb6 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/protoBuilder/LoginMsgBuilder.java @@ -0,0 +1,43 @@ +/** + * Created by 尼恩 at 疯狂创客圈 + */ + +package com.zpf.imClient.protoBuilder; + + +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.im.common.bean.msg.User; +import com.zpf.imClient.client.ClientSession; + +/** + * 登陆消息Builder + */ +public class LoginMsgBuilder extends BaseBuilder { + private final User user; + + public LoginMsgBuilder(User user, ClientSession session) { + super(ProtoMsg.HeadType.LOGIN_REQUEST, session); + this.user = user; + } + + public ProtoMsg.Message build() { + ProtoMsg.Message message = buildCommon(-1); + ProtoMsg.LoginRequest.Builder lb = + ProtoMsg.LoginRequest.newBuilder() + .setDeviceId(user.getDevId()) + .setPlatform(user.getPlatForm().ordinal()) + .setToken(user.getToken()) + .setUid(user.getUid()); + return message.toBuilder().setLoginRequest(lb).build(); + } + + public static ProtoMsg.Message buildLoginMsg( + User user, ClientSession session) { + LoginMsgBuilder builder = + new LoginMsgBuilder(user, session); + return builder.build(); + + } +} + + diff --git a/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java b/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java index bf0821b..f2c1d5f 100644 --- a/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java +++ b/chatClient/src/main/java/com/zpf/imClient/sender/BaseSender.java @@ -1,9 +1,13 @@ package com.zpf.imClient.sender; +import com.zpf.im.common.bean.msg.ProtoMsg; import com.zpf.im.common.bean.msg.User; import com.zpf.imClient.client.ClientSession; +import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.GenericFutureListener; import lombok.Data; - @Data public abstract class BaseSender { private User user; @@ -27,31 +31,35 @@ public abstract class BaseSender { + public void sendMsg(ProtoMsg.Message message){ + if (null == getSession() || !isConnected()){ + System.out.println("连接还没成功"); + return; + } + Channel channel = getSession().getChannel(); + ChannelFuture future = channel.writeAndFlush(message); + future.addListener(new GenericFutureListener>() { + @Override + public void operationComplete(Future future) throws Exception { + if (future.isSuccess()){ + sendSuccees(message); + } else { + sendFailed(message); + } + } + }); + } + protected void sendFailed(ProtoMsg.Message message){ + System.out.println("发送成功"); + }; - - - - - - - - - - - - - - - - - - - - + protected void sendSuccees(ProtoMsg.Message message){ + System.out.println("发送失败"); + }; } diff --git a/chatClient/src/main/java/com/zpf/imClient/sender/ChatSender.java b/chatClient/src/main/java/com/zpf/imClient/sender/ChatSender.java new file mode 100644 index 0000000..60df002 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/sender/ChatSender.java @@ -0,0 +1,36 @@ +package com.zpf.imClient.sender; + +import com.zpf.im.common.bean.msg.ChatMsg; +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.imClient.protoBuilder.ChatMsgBuilder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Service("ChatSender") +@Slf4j +public class ChatSender extends BaseSender { + + + public void sendChatMsg(String touid,String content){ + log.info("发送消息 startConnectServer"); + ChatMsg chatMsg = new ChatMsg(getUser()); + chatMsg.setContent(content); + chatMsg.setMsgType(ChatMsg.MSGTYPE.TEXT); + chatMsg.setTo(touid); + chatMsg.setMsgId(System.currentTimeMillis()); + ProtoMsg.Message message = ChatMsgBuilder.buildChatMsg(chatMsg, getUser(), getSession()); + super.sendMsg(message); + } + + + @Override + protected void sendSuccees(ProtoMsg.Message message) { + log.info("发送成功:"+message.getMessageRequest().getContent()); + } + + + @Override + protected void sendFailed(ProtoMsg.Message message) { + log.info("发送失败:"+message.getMessageRequest().getContent()); + } +} diff --git a/chatClient/src/main/java/com/zpf/imClient/sender/LoginSender.java b/chatClient/src/main/java/com/zpf/imClient/sender/LoginSender.java new file mode 100644 index 0000000..87156f4 --- /dev/null +++ b/chatClient/src/main/java/com/zpf/imClient/sender/LoginSender.java @@ -0,0 +1,31 @@ +package com.zpf.imClient.sender; + +import com.zpf.im.common.bean.msg.ProtoMsg; +import com.zpf.imClient.protoBuilder.LoginMsgBuilder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +@Slf4j +@Service("LoginSender") +public class LoginSender extends BaseSender { + + + public void dendLoginMsg(){ + if (!isConnected()){ + log.info("还没有建立连接"); + return; + } + log.info("构造登录消息"); + ProtoMsg.Message message = LoginMsgBuilder.buildLoginMsg(getUser(), getSession()); + log.info("发送登录消息"); + super.sendMsg(message); + + } + + + + + + + + +} -- Gitee