parent
87a0f1130f
commit
ee0220a0eb
11 changed files with 71 additions and 1384 deletions
@ -1,28 +0,0 @@ |
|||||||
package cn.org.hentai.jtt1078.controller; |
|
||||||
|
|
||||||
import cn.org.hentai.jtt1078.publisher.PublishManager; |
|
||||||
import org.springframework.web.bind.annotation.GetMapping; |
|
||||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||||
import org.springframework.web.bind.annotation.RestController; |
|
||||||
|
|
||||||
import java.util.*; |
|
||||||
|
|
||||||
@RestController |
|
||||||
@RequestMapping |
|
||||||
public class BusinessController { |
|
||||||
|
|
||||||
/** |
|
||||||
* 获取当前推送视频车载机的clientID |
|
||||||
* |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
@GetMapping("device/currentPush") |
|
||||||
public Map<String, String> getCurPushDevice() { |
|
||||||
Map<String, String> data = new HashMap<>(); |
|
||||||
data.put("status", "OK"); |
|
||||||
data.put("code", "200"); |
|
||||||
data.put("data", PublishManager.getInstance().getCurPushDevice()); |
|
||||||
return data; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -1,259 +0,0 @@ |
|||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
||||||
// source: Command.proto
|
|
||||||
|
|
||||||
package cn.org.hentai.jtt1078.test; |
|
||||||
|
|
||||||
public final class Command { |
|
||||||
private Command() {} |
|
||||||
public static void registerAllExtensions( |
|
||||||
com.google.protobuf.ExtensionRegistryLite registry) { |
|
||||||
} |
|
||||||
|
|
||||||
public static void registerAllExtensions( |
|
||||||
com.google.protobuf.ExtensionRegistry registry) { |
|
||||||
registerAllExtensions( |
|
||||||
(com.google.protobuf.ExtensionRegistryLite) registry); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 指令类型 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* Protobuf enum {@code CommandType} |
|
||||||
*/ |
|
||||||
public enum CommandType |
|
||||||
implements com.google.protobuf.ProtocolMessageEnum { |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 验证 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>AUTH = 1;</code> |
|
||||||
*/ |
|
||||||
AUTH(1), |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* ping |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>PING = 2;</code> |
|
||||||
*/ |
|
||||||
PING(2), |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* pong |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>PONG = 3;</code> |
|
||||||
*/ |
|
||||||
PONG(3), |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 上传数据 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>UPLOAD_DATA = 4;</code> |
|
||||||
*/ |
|
||||||
UPLOAD_DATA(4), |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 推送数据 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>PUSH_DATA = 5;</code> |
|
||||||
*/ |
|
||||||
PUSH_DATA(5), |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 验证返回 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>AUTH_BACK = 11;</code> |
|
||||||
*/ |
|
||||||
AUTH_BACK(11), |
|
||||||
/** |
|
||||||
* <code>UPLOAD_DATA_BACK = 14;</code> |
|
||||||
*/ |
|
||||||
UPLOAD_DATA_BACK(14), |
|
||||||
/** |
|
||||||
* <code>PUSH_DATA_BACK = 15;</code> |
|
||||||
*/ |
|
||||||
PUSH_DATA_BACK(15), |
|
||||||
; |
|
||||||
|
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 验证 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>AUTH = 1;</code> |
|
||||||
*/ |
|
||||||
public static final int AUTH_VALUE = 1; |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* ping |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>PING = 2;</code> |
|
||||||
*/ |
|
||||||
public static final int PING_VALUE = 2; |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* pong |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>PONG = 3;</code> |
|
||||||
*/ |
|
||||||
public static final int PONG_VALUE = 3; |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 上传数据 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>UPLOAD_DATA = 4;</code> |
|
||||||
*/ |
|
||||||
public static final int UPLOAD_DATA_VALUE = 4; |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 推送数据 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>PUSH_DATA = 5;</code> |
|
||||||
*/ |
|
||||||
public static final int PUSH_DATA_VALUE = 5; |
|
||||||
/** |
|
||||||
* <pre> |
|
||||||
** |
|
||||||
* 验证返回 |
|
||||||
* </pre> |
|
||||||
* |
|
||||||
* <code>AUTH_BACK = 11;</code> |
|
||||||
*/ |
|
||||||
public static final int AUTH_BACK_VALUE = 11; |
|
||||||
/** |
|
||||||
* <code>UPLOAD_DATA_BACK = 14;</code> |
|
||||||
*/ |
|
||||||
public static final int UPLOAD_DATA_BACK_VALUE = 14; |
|
||||||
/** |
|
||||||
* <code>PUSH_DATA_BACK = 15;</code> |
|
||||||
*/ |
|
||||||
public static final int PUSH_DATA_BACK_VALUE = 15; |
|
||||||
|
|
||||||
|
|
||||||
public final int getNumber() { |
|
||||||
return value; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @deprecated Use {@link #forNumber(int)} instead. |
|
||||||
*/ |
|
||||||
@Deprecated |
|
||||||
public static CommandType valueOf(int value) { |
|
||||||
return forNumber(value); |
|
||||||
} |
|
||||||
|
|
||||||
public static CommandType forNumber(int value) { |
|
||||||
switch (value) { |
|
||||||
case 1: return AUTH; |
|
||||||
case 2: return PING; |
|
||||||
case 3: return PONG; |
|
||||||
case 4: return UPLOAD_DATA; |
|
||||||
case 5: return PUSH_DATA; |
|
||||||
case 11: return AUTH_BACK; |
|
||||||
case 14: return UPLOAD_DATA_BACK; |
|
||||||
case 15: return PUSH_DATA_BACK; |
|
||||||
default: return null; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static com.google.protobuf.Internal.EnumLiteMap<CommandType> |
|
||||||
internalGetValueMap() { |
|
||||||
return internalValueMap; |
|
||||||
} |
|
||||||
private static final com.google.protobuf.Internal.EnumLiteMap< |
|
||||||
CommandType> internalValueMap = |
|
||||||
new com.google.protobuf.Internal.EnumLiteMap<CommandType>() { |
|
||||||
public CommandType findValueByNumber(int number) { |
|
||||||
return CommandType.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 Command.getDescriptor().getEnumTypes().get(0); |
|
||||||
} |
|
||||||
|
|
||||||
private static final CommandType[] VALUES = values(); |
|
||||||
|
|
||||||
public static CommandType valueOf( |
|
||||||
com.google.protobuf.Descriptors.EnumValueDescriptor desc) { |
|
||||||
if (desc.getType() != getDescriptor()) { |
|
||||||
throw new IllegalArgumentException( |
|
||||||
"EnumValueDescriptor is not for this type."); |
|
||||||
} |
|
||||||
return VALUES[desc.getIndex()]; |
|
||||||
} |
|
||||||
|
|
||||||
private final int value; |
|
||||||
|
|
||||||
private CommandType(int value) { |
|
||||||
this.value = value; |
|
||||||
} |
|
||||||
|
|
||||||
// @@protoc_insertion_point(enum_scope:CommandType)
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public static com.google.protobuf.Descriptors.FileDescriptor |
|
||||||
getDescriptor() { |
|
||||||
return descriptor; |
|
||||||
} |
|
||||||
private static com.google.protobuf.Descriptors.FileDescriptor |
|
||||||
descriptor; |
|
||||||
static { |
|
||||||
String[] descriptorData = { |
|
||||||
"\n\rCommand.proto\032\rCommand.proto*\204\001\n\013Comma" + |
|
||||||
"ndType\022\010\n\004AUTH\020\001\022\010\n\004PING\020\002\022\010\n\004PONG\020\003\022\017\n\013" + |
|
||||||
"UPLOAD_DATA\020\004\022\r\n\tPUSH_DATA\020\005\022\r\n\tAUTH_BAC" + |
|
||||||
"K\020\013\022\024\n\020UPLOAD_DATA_BACK\020\016\022\022\n\016PUSH_DATA_B" + |
|
||||||
"ACK\020\017B$\n\031com.netty.common.protobufB\007Comm" + |
|
||||||
"and" |
|
||||||
}; |
|
||||||
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[] { |
|
||||||
Command.getDescriptor(), |
|
||||||
}, assigner); |
|
||||||
Command.getDescriptor(); |
|
||||||
} |
|
||||||
|
|
||||||
// @@protoc_insertion_point(outer_class_scope)
|
|
||||||
} |
|
||||||
@ -1,39 +0,0 @@ |
|||||||
syntax = "proto2"; |
|
||||||
|
|
||||||
option java_package="cn.myzf.common.protobuf"; |
|
||||||
option java_outer_classname = "Command"; |
|
||||||
import "cn/myzf/common/protobuf/Command.proto"; |
|
||||||
/** |
|
||||||
* 指令类型 |
|
||||||
*/ |
|
||||||
enum CommandType { |
|
||||||
/** |
|
||||||
* 验证 |
|
||||||
*/ |
|
||||||
AUTH = 1; |
|
||||||
/** |
|
||||||
* ping |
|
||||||
*/ |
|
||||||
PING = 2; |
|
||||||
/** |
|
||||||
* pong |
|
||||||
*/ |
|
||||||
PONG = 3; |
|
||||||
/** |
|
||||||
* 上传数据 |
|
||||||
*/ |
|
||||||
UPLOAD_DATA = 4; |
|
||||||
/** |
|
||||||
* 推送数据 |
|
||||||
*/ |
|
||||||
PUSH_DATA = 5; |
|
||||||
|
|
||||||
/** |
|
||||||
* 验证返回 |
|
||||||
*/ |
|
||||||
AUTH_BACK = 11; |
|
||||||
|
|
||||||
UPLOAD_DATA_BACK = 14; |
|
||||||
|
|
||||||
PUSH_DATA_BACK = 15; |
|
||||||
} |
|
||||||
@ -1,109 +0,0 @@ |
|||||||
package cn.org.hentai.jtt1078.test; |
|
||||||
|
|
||||||
import cn.org.hentai.jtt1078.app.VideoServerApp; |
|
||||||
import cn.org.hentai.jtt1078.util.Packet; |
|
||||||
import io.netty.bootstrap.Bootstrap; |
|
||||||
import io.netty.buffer.ByteBufUtil; |
|
||||||
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.handler.codec.protobuf.ProtobufDecoder; |
|
||||||
import io.netty.handler.codec.protobuf.ProtobufEncoder; |
|
||||||
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder; |
|
||||||
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender; |
|
||||||
import io.netty.handler.timeout.IdleStateHandler; |
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets; |
|
||||||
import java.util.Timer; |
|
||||||
import java.util.TimerTask; |
|
||||||
import java.util.concurrent.TimeUnit; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by matrixy on 2019/12/18. |
|
||||||
*/ |
|
||||||
public class Connect808Test { |
|
||||||
private final static String HOST = "127.0.0.1"; |
|
||||||
private final static int PORT = 19999; |
|
||||||
// private final static int PORT = 7611;
|
|
||||||
private final static int READER_IDLE_TIME_SECONDS = 0;//读操作空闲20秒
|
|
||||||
private final static int WRITER_IDLE_TIME_SECONDS = 5;//写操作空闲20秒
|
|
||||||
private final static int ALL_IDLE_TIME_SECONDS = 0;//读写全部空闲40秒
|
|
||||||
|
|
||||||
public static void main(String[] args) { |
|
||||||
String host = "127.0.0.1"; |
|
||||||
// int port = 7611;
|
|
||||||
int port = 19999; |
|
||||||
|
|
||||||
new Thread(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
try { |
|
||||||
new Connect808Test().doConnect(new Bootstrap(), new NioEventLoopGroup()); |
|
||||||
} catch (Exception e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} |
|
||||||
} |
|
||||||
}).start(); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* netty client 连接,连接失败5秒后重试连接 |
|
||||||
*/ |
|
||||||
public Bootstrap doConnect(Bootstrap bootstrap, EventLoopGroup eventLoopGroup) { |
|
||||||
try { |
|
||||||
if (bootstrap != null) { |
|
||||||
bootstrap.group(eventLoopGroup); |
|
||||||
bootstrap.channel(NioSocketChannel.class); |
|
||||||
bootstrap.option(ChannelOption.SO_KEEPALIVE, true); |
|
||||||
bootstrap.handler(new ChannelInitializer<SocketChannel>() { |
|
||||||
@Override |
|
||||||
public void initChannel(SocketChannel ch) throws Exception { |
|
||||||
ChannelPipeline p = ch.pipeline(); |
|
||||||
p.addLast("idleStateHandler", new IdleStateHandler(READER_IDLE_TIME_SECONDS |
|
||||||
, WRITER_IDLE_TIME_SECONDS, ALL_IDLE_TIME_SECONDS, TimeUnit.SECONDS)); |
|
||||||
|
|
||||||
p.addLast(new ProtobufVarint32FrameDecoder()); |
|
||||||
p.addLast(new ProtobufDecoder(Message.MessageBase.getDefaultInstance())); |
|
||||||
|
|
||||||
p.addLast(new ProtobufVarint32LengthFieldPrepender()); |
|
||||||
p.addLast(new ProtobufEncoder()); |
|
||||||
|
|
||||||
p.addLast("clientHandler", new LogicClientHandler()); |
|
||||||
// p.addLast("idleTimeoutHandler", new HeartHandler(NettyClient.this));
|
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
bootstrap.remoteAddress(HOST, PORT); |
|
||||||
ChannelFuture f = bootstrap.connect().addListener((ChannelFuture futureListener) -> { |
|
||||||
final EventLoop eventLoop = futureListener.channel().eventLoop(); |
|
||||||
if (!futureListener.isSuccess()) { |
|
||||||
// log.warn("连接服务器失败,5s后重新尝试连接!");
|
|
||||||
futureListener.channel().eventLoop().schedule(() -> doConnect(new Bootstrap(), eventLoop), 5, TimeUnit.SECONDS); |
|
||||||
} |
|
||||||
}); |
|
||||||
f.channel().closeFuture().sync(); |
|
||||||
} |
|
||||||
} catch (InterruptedException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} |
|
||||||
return bootstrap; |
|
||||||
} |
|
||||||
|
|
||||||
private void startConsoleThread(Channel channel) { |
|
||||||
new Thread(() -> { |
|
||||||
new Timer().schedule(new TimerTask() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
System.out.print("输入消息发送至服务端 : "); |
|
||||||
String hex = "7e0100002e0123456789017fff001f00730000000034000000000000000000000042534a2d47462d30367465737431323301b2e241383838383838157e"; |
|
||||||
Packet packet = Packet.create(hex.getBytes()); |
|
||||||
byte[] bytes = "|123,0100,1000;test|".getBytes(StandardCharsets.UTF_8); |
|
||||||
String data = ByteBufUtil.hexDump(bytes); |
|
||||||
System.out.println(data); |
|
||||||
channel.writeAndFlush(bytes); |
|
||||||
} |
|
||||||
}, 1000, 10000); |
|
||||||
}).start(); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,36 +0,0 @@ |
|||||||
package cn.org.hentai.jtt1078.test; |
|
||||||
|
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext; |
|
||||||
import io.netty.channel.SimpleChannelInboundHandler; |
|
||||||
import org.slf4j.Logger; |
|
||||||
import org.slf4j.LoggerFactory; |
|
||||||
|
|
||||||
public class LogicClientHandler extends SimpleChannelInboundHandler<Message> { |
|
||||||
public Logger log = LoggerFactory.getLogger(this.getClass()); |
|
||||||
|
|
||||||
private final static String CLIENTID = "test11111"; |
|
||||||
|
|
||||||
// 连接成功后,向server发送消息
|
|
||||||
@Override |
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception { |
|
||||||
Message.MessageBase.Builder authMsg = Message.MessageBase.newBuilder(); |
|
||||||
authMsg.setClientId(CLIENTID); |
|
||||||
authMsg.setCmd(Command.CommandType.AUTH); |
|
||||||
// authMsg.setCmd(null);
|
|
||||||
authMsg.setData("This is auth data44444444444444444"); |
|
||||||
|
|
||||||
ctx.writeAndFlush(authMsg.build()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { |
|
||||||
log.debug("连接断开"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, Message msg) throws Exception { |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
@ -1,879 +0,0 @@ |
|||||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
||||||
// source: Message.proto
|
|
||||||
|
|
||||||
package cn.org.hentai.jtt1078.test; |
|
||||||
|
|
||||||
public final class Message { |
|
||||||
private Message() {} |
|
||||||
public static void registerAllExtensions( |
|
||||||
com.google.protobuf.ExtensionRegistryLite registry) { |
|
||||||
} |
|
||||||
|
|
||||||
public static void registerAllExtensions( |
|
||||||
com.google.protobuf.ExtensionRegistry registry) { |
|
||||||
registerAllExtensions( |
|
||||||
(com.google.protobuf.ExtensionRegistryLite) registry); |
|
||||||
} |
|
||||||
public interface MessageBaseOrBuilder extends |
|
||||||
// @@protoc_insertion_point(interface_extends:MessageBase)
|
|
||||||
com.google.protobuf.MessageOrBuilder { |
|
||||||
|
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
boolean hasClientId(); |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
String getClientId(); |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
com.google.protobuf.ByteString |
|
||||||
getClientIdBytes(); |
|
||||||
|
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
boolean hasCmd(); |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
Command.CommandType getCmd(); |
|
||||||
|
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
boolean hasData(); |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
String getData(); |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
com.google.protobuf.ByteString |
|
||||||
getDataBytes(); |
|
||||||
} |
|
||||||
/** |
|
||||||
* Protobuf type {@code MessageBase} |
|
||||||
*/ |
|
||||||
public static final class MessageBase extends |
|
||||||
com.google.protobuf.GeneratedMessageV3 implements |
|
||||||
// @@protoc_insertion_point(message_implements:MessageBase)
|
|
||||||
MessageBaseOrBuilder { |
|
||||||
// Use MessageBase.newBuilder() to construct.
|
|
||||||
private MessageBase(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { |
|
||||||
super(builder); |
|
||||||
} |
|
||||||
private MessageBase() { |
|
||||||
clientId_ = ""; |
|
||||||
cmd_ = 1; |
|
||||||
data_ = ""; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public final com.google.protobuf.UnknownFieldSet |
|
||||||
getUnknownFields() { |
|
||||||
return this.unknownFields; |
|
||||||
} |
|
||||||
private MessageBase( |
|
||||||
com.google.protobuf.CodedInputStream input, |
|
||||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
|
||||||
throws com.google.protobuf.InvalidProtocolBufferException { |
|
||||||
this(); |
|
||||||
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; |
|
||||||
default: { |
|
||||||
if (!parseUnknownField(input, unknownFields, |
|
||||||
extensionRegistry, tag)) { |
|
||||||
done = true; |
|
||||||
} |
|
||||||
break; |
|
||||||
} |
|
||||||
case 10: { |
|
||||||
com.google.protobuf.ByteString bs = input.readBytes(); |
|
||||||
bitField0_ |= 0x00000001; |
|
||||||
clientId_ = bs; |
|
||||||
break; |
|
||||||
} |
|
||||||
case 16: { |
|
||||||
int rawValue = input.readEnum(); |
|
||||||
Command.CommandType value = Command.CommandType.valueOf(rawValue); |
|
||||||
if (value == null) { |
|
||||||
unknownFields.mergeVarintField(2, rawValue); |
|
||||||
} else { |
|
||||||
bitField0_ |= 0x00000002; |
|
||||||
cmd_ = rawValue; |
|
||||||
} |
|
||||||
break; |
|
||||||
} |
|
||||||
case 26: { |
|
||||||
com.google.protobuf.ByteString bs = input.readBytes(); |
|
||||||
bitField0_ |= 0x00000004; |
|
||||||
data_ = bs; |
|
||||||
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 Message.internal_static_MessageBase_descriptor; |
|
||||||
} |
|
||||||
|
|
||||||
protected FieldAccessorTable |
|
||||||
internalGetFieldAccessorTable() { |
|
||||||
return Message.internal_static_MessageBase_fieldAccessorTable |
|
||||||
.ensureFieldAccessorsInitialized( |
|
||||||
Message.MessageBase.class, Message.MessageBase.Builder.class); |
|
||||||
} |
|
||||||
|
|
||||||
private int bitField0_; |
|
||||||
public static final int CLIENTID_FIELD_NUMBER = 1; |
|
||||||
private volatile Object clientId_; |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public boolean hasClientId() { |
|
||||||
return ((bitField0_ & 0x00000001) == 0x00000001); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public String getClientId() { |
|
||||||
Object ref = clientId_; |
|
||||||
if (ref instanceof String) { |
|
||||||
return (String) ref; |
|
||||||
} else { |
|
||||||
com.google.protobuf.ByteString bs = |
|
||||||
(com.google.protobuf.ByteString) ref; |
|
||||||
String s = bs.toStringUtf8(); |
|
||||||
if (bs.isValidUtf8()) { |
|
||||||
clientId_ = s; |
|
||||||
} |
|
||||||
return s; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public com.google.protobuf.ByteString |
|
||||||
getClientIdBytes() { |
|
||||||
Object ref = clientId_; |
|
||||||
if (ref instanceof String) { |
|
||||||
com.google.protobuf.ByteString b = |
|
||||||
com.google.protobuf.ByteString.copyFromUtf8( |
|
||||||
(String) ref); |
|
||||||
clientId_ = b; |
|
||||||
return b; |
|
||||||
} else { |
|
||||||
return (com.google.protobuf.ByteString) ref; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static final int CMD_FIELD_NUMBER = 2; |
|
||||||
private int cmd_; |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
public boolean hasCmd() { |
|
||||||
return ((bitField0_ & 0x00000002) == 0x00000002); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
public Command.CommandType getCmd() { |
|
||||||
Command.CommandType result = Command.CommandType.valueOf(cmd_); |
|
||||||
return result == null ? Command.CommandType.AUTH : result; |
|
||||||
} |
|
||||||
|
|
||||||
public static final int DATA_FIELD_NUMBER = 3; |
|
||||||
private volatile Object data_; |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public boolean hasData() { |
|
||||||
return ((bitField0_ & 0x00000004) == 0x00000004); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public String getData() { |
|
||||||
Object ref = data_; |
|
||||||
if (ref instanceof String) { |
|
||||||
return (String) ref; |
|
||||||
} else { |
|
||||||
com.google.protobuf.ByteString bs = |
|
||||||
(com.google.protobuf.ByteString) ref; |
|
||||||
String s = bs.toStringUtf8(); |
|
||||||
if (bs.isValidUtf8()) { |
|
||||||
data_ = s; |
|
||||||
} |
|
||||||
return s; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public com.google.protobuf.ByteString |
|
||||||
getDataBytes() { |
|
||||||
Object ref = data_; |
|
||||||
if (ref instanceof String) { |
|
||||||
com.google.protobuf.ByteString b = |
|
||||||
com.google.protobuf.ByteString.copyFromUtf8( |
|
||||||
(String) ref); |
|
||||||
data_ = b; |
|
||||||
return b; |
|
||||||
} else { |
|
||||||
return (com.google.protobuf.ByteString) ref; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private byte memoizedIsInitialized = -1; |
|
||||||
public final boolean isInitialized() { |
|
||||||
byte isInitialized = memoizedIsInitialized; |
|
||||||
if (isInitialized == 1) return true; |
|
||||||
if (isInitialized == 0) return false; |
|
||||||
|
|
||||||
if (!hasClientId()) { |
|
||||||
memoizedIsInitialized = 0; |
|
||||||
return false; |
|
||||||
} |
|
||||||
if (!hasCmd()) { |
|
||||||
memoizedIsInitialized = 0; |
|
||||||
return false; |
|
||||||
} |
|
||||||
memoizedIsInitialized = 1; |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
public void writeTo(com.google.protobuf.CodedOutputStream output) |
|
||||||
throws java.io.IOException { |
|
||||||
if (((bitField0_ & 0x00000001) == 0x00000001)) { |
|
||||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, clientId_); |
|
||||||
} |
|
||||||
if (((bitField0_ & 0x00000002) == 0x00000002)) { |
|
||||||
output.writeEnum(2, cmd_); |
|
||||||
} |
|
||||||
if (((bitField0_ & 0x00000004) == 0x00000004)) { |
|
||||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, data_); |
|
||||||
} |
|
||||||
unknownFields.writeTo(output); |
|
||||||
} |
|
||||||
|
|
||||||
public int getSerializedSize() { |
|
||||||
int size = memoizedSize; |
|
||||||
if (size != -1) return size; |
|
||||||
|
|
||||||
size = 0; |
|
||||||
if (((bitField0_ & 0x00000001) == 0x00000001)) { |
|
||||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, clientId_); |
|
||||||
} |
|
||||||
if (((bitField0_ & 0x00000002) == 0x00000002)) { |
|
||||||
size += com.google.protobuf.CodedOutputStream |
|
||||||
.computeEnumSize(2, cmd_); |
|
||||||
} |
|
||||||
if (((bitField0_ & 0x00000004) == 0x00000004)) { |
|
||||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, data_); |
|
||||||
} |
|
||||||
size += unknownFields.getSerializedSize(); |
|
||||||
memoizedSize = size; |
|
||||||
return size; |
|
||||||
} |
|
||||||
|
|
||||||
private static final long serialVersionUID = 0L; |
|
||||||
@Override |
|
||||||
public boolean equals(final Object obj) { |
|
||||||
if (obj == this) { |
|
||||||
return true; |
|
||||||
} |
|
||||||
if (!(obj instanceof Message.MessageBase)) { |
|
||||||
return super.equals(obj); |
|
||||||
} |
|
||||||
Message.MessageBase other = (Message.MessageBase) obj; |
|
||||||
|
|
||||||
boolean result = true; |
|
||||||
result = result && (hasClientId() == other.hasClientId()); |
|
||||||
if (hasClientId()) { |
|
||||||
result = result && getClientId() |
|
||||||
.equals(other.getClientId()); |
|
||||||
} |
|
||||||
result = result && (hasCmd() == other.hasCmd()); |
|
||||||
if (hasCmd()) { |
|
||||||
result = result && cmd_ == other.cmd_; |
|
||||||
} |
|
||||||
result = result && (hasData() == other.hasData()); |
|
||||||
if (hasData()) { |
|
||||||
result = result && getData() |
|
||||||
.equals(other.getData()); |
|
||||||
} |
|
||||||
result = result && unknownFields.equals(other.unknownFields); |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public int hashCode() { |
|
||||||
if (memoizedHashCode != 0) { |
|
||||||
return memoizedHashCode; |
|
||||||
} |
|
||||||
int hash = 41; |
|
||||||
hash = (19 * hash) + getDescriptorForType().hashCode(); |
|
||||||
if (hasClientId()) { |
|
||||||
hash = (37 * hash) + CLIENTID_FIELD_NUMBER; |
|
||||||
hash = (53 * hash) + getClientId().hashCode(); |
|
||||||
} |
|
||||||
if (hasCmd()) { |
|
||||||
hash = (37 * hash) + CMD_FIELD_NUMBER; |
|
||||||
hash = (53 * hash) + cmd_; |
|
||||||
} |
|
||||||
if (hasData()) { |
|
||||||
hash = (37 * hash) + DATA_FIELD_NUMBER; |
|
||||||
hash = (53 * hash) + getData().hashCode(); |
|
||||||
} |
|
||||||
hash = (29 * hash) + unknownFields.hashCode(); |
|
||||||
memoizedHashCode = hash; |
|
||||||
return hash; |
|
||||||
} |
|
||||||
|
|
||||||
public static Message.MessageBase parseFrom( |
|
||||||
com.google.protobuf.ByteString data) |
|
||||||
throws com.google.protobuf.InvalidProtocolBufferException { |
|
||||||
return PARSER.parseFrom(data); |
|
||||||
} |
|
||||||
public static Message.MessageBase parseFrom( |
|
||||||
com.google.protobuf.ByteString data, |
|
||||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
|
||||||
throws com.google.protobuf.InvalidProtocolBufferException { |
|
||||||
return PARSER.parseFrom(data, extensionRegistry); |
|
||||||
} |
|
||||||
public static Message.MessageBase parseFrom(byte[] data) |
|
||||||
throws com.google.protobuf.InvalidProtocolBufferException { |
|
||||||
return PARSER.parseFrom(data); |
|
||||||
} |
|
||||||
public static Message.MessageBase parseFrom( |
|
||||||
byte[] data, |
|
||||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
|
||||||
throws com.google.protobuf.InvalidProtocolBufferException { |
|
||||||
return PARSER.parseFrom(data, extensionRegistry); |
|
||||||
} |
|
||||||
public static Message.MessageBase parseFrom(java.io.InputStream input) |
|
||||||
throws java.io.IOException { |
|
||||||
return com.google.protobuf.GeneratedMessageV3 |
|
||||||
.parseWithIOException(PARSER, input); |
|
||||||
} |
|
||||||
public static Message.MessageBase 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 Message.MessageBase parseDelimitedFrom(java.io.InputStream input) |
|
||||||
throws java.io.IOException { |
|
||||||
return com.google.protobuf.GeneratedMessageV3 |
|
||||||
.parseDelimitedWithIOException(PARSER, input); |
|
||||||
} |
|
||||||
public static Message.MessageBase 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 Message.MessageBase parseFrom( |
|
||||||
com.google.protobuf.CodedInputStream input) |
|
||||||
throws java.io.IOException { |
|
||||||
return com.google.protobuf.GeneratedMessageV3 |
|
||||||
.parseWithIOException(PARSER, input); |
|
||||||
} |
|
||||||
public static Message.MessageBase parseFrom( |
|
||||||
com.google.protobuf.CodedInputStream input, |
|
||||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
|
||||||
throws java.io.IOException { |
|
||||||
return com.google.protobuf.GeneratedMessageV3 |
|
||||||
.parseWithIOException(PARSER, input, extensionRegistry); |
|
||||||
} |
|
||||||
|
|
||||||
public Builder newBuilderForType() { return newBuilder(); } |
|
||||||
public static Builder newBuilder() { |
|
||||||
return DEFAULT_INSTANCE.toBuilder(); |
|
||||||
} |
|
||||||
public static Builder newBuilder(Message.MessageBase prototype) { |
|
||||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); |
|
||||||
} |
|
||||||
public Builder toBuilder() { |
|
||||||
return this == DEFAULT_INSTANCE |
|
||||||
? new Builder() : new Builder().mergeFrom(this); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected Builder newBuilderForType( |
|
||||||
BuilderParent parent) { |
|
||||||
Builder builder = new Builder(parent); |
|
||||||
return builder; |
|
||||||
} |
|
||||||
/** |
|
||||||
* Protobuf type {@code MessageBase} |
|
||||||
*/ |
|
||||||
public static final class Builder extends |
|
||||||
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements |
|
||||||
// @@protoc_insertion_point(builder_implements:MessageBase)
|
|
||||||
Message.MessageBaseOrBuilder { |
|
||||||
public static final com.google.protobuf.Descriptors.Descriptor |
|
||||||
getDescriptor() { |
|
||||||
return Message.internal_static_MessageBase_descriptor; |
|
||||||
} |
|
||||||
|
|
||||||
protected FieldAccessorTable |
|
||||||
internalGetFieldAccessorTable() { |
|
||||||
return Message.internal_static_MessageBase_fieldAccessorTable |
|
||||||
.ensureFieldAccessorsInitialized( |
|
||||||
Message.MessageBase.class, Message.MessageBase.Builder.class); |
|
||||||
} |
|
||||||
|
|
||||||
// Construct using Message.MessageBase.newBuilder()
|
|
||||||
private Builder() { |
|
||||||
maybeForceBuilderInitialization(); |
|
||||||
} |
|
||||||
|
|
||||||
private Builder( |
|
||||||
BuilderParent parent) { |
|
||||||
super(parent); |
|
||||||
maybeForceBuilderInitialization(); |
|
||||||
} |
|
||||||
private void maybeForceBuilderInitialization() { |
|
||||||
if (com.google.protobuf.GeneratedMessageV3 |
|
||||||
.alwaysUseFieldBuilders) { |
|
||||||
} |
|
||||||
} |
|
||||||
public Builder clear() { |
|
||||||
super.clear(); |
|
||||||
clientId_ = ""; |
|
||||||
bitField0_ = (bitField0_ & ~0x00000001); |
|
||||||
cmd_ = 1; |
|
||||||
bitField0_ = (bitField0_ & ~0x00000002); |
|
||||||
data_ = ""; |
|
||||||
bitField0_ = (bitField0_ & ~0x00000004); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public com.google.protobuf.Descriptors.Descriptor |
|
||||||
getDescriptorForType() { |
|
||||||
return Message.internal_static_MessageBase_descriptor; |
|
||||||
} |
|
||||||
|
|
||||||
public Message.MessageBase getDefaultInstanceForType() { |
|
||||||
return Message.MessageBase.getDefaultInstance(); |
|
||||||
} |
|
||||||
|
|
||||||
public Message.MessageBase build() { |
|
||||||
Message.MessageBase result = buildPartial(); |
|
||||||
if (!result.isInitialized()) { |
|
||||||
throw newUninitializedMessageException(result); |
|
||||||
} |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
public Message.MessageBase buildPartial() { |
|
||||||
Message.MessageBase result = new Message.MessageBase(this); |
|
||||||
int from_bitField0_ = bitField0_; |
|
||||||
int to_bitField0_ = 0; |
|
||||||
if (((from_bitField0_ & 0x00000001) == 0x00000001)) { |
|
||||||
to_bitField0_ |= 0x00000001; |
|
||||||
} |
|
||||||
result.clientId_ = clientId_; |
|
||||||
if (((from_bitField0_ & 0x00000002) == 0x00000002)) { |
|
||||||
to_bitField0_ |= 0x00000002; |
|
||||||
} |
|
||||||
result.cmd_ = cmd_; |
|
||||||
if (((from_bitField0_ & 0x00000004) == 0x00000004)) { |
|
||||||
to_bitField0_ |= 0x00000004; |
|
||||||
} |
|
||||||
result.data_ = data_; |
|
||||||
result.bitField0_ = to_bitField0_; |
|
||||||
onBuilt(); |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
public Builder clone() { |
|
||||||
return (Builder) super.clone(); |
|
||||||
} |
|
||||||
public Builder setField( |
|
||||||
com.google.protobuf.Descriptors.FieldDescriptor field, |
|
||||||
Object value) { |
|
||||||
return (Builder) super.setField(field, value); |
|
||||||
} |
|
||||||
public Builder clearField( |
|
||||||
com.google.protobuf.Descriptors.FieldDescriptor field) { |
|
||||||
return (Builder) super.clearField(field); |
|
||||||
} |
|
||||||
public Builder clearOneof( |
|
||||||
com.google.protobuf.Descriptors.OneofDescriptor oneof) { |
|
||||||
return (Builder) super.clearOneof(oneof); |
|
||||||
} |
|
||||||
public Builder setRepeatedField( |
|
||||||
com.google.protobuf.Descriptors.FieldDescriptor field, |
|
||||||
int index, Object value) { |
|
||||||
return (Builder) super.setRepeatedField(field, index, value); |
|
||||||
} |
|
||||||
public Builder addRepeatedField( |
|
||||||
com.google.protobuf.Descriptors.FieldDescriptor field, |
|
||||||
Object value) { |
|
||||||
return (Builder) super.addRepeatedField(field, value); |
|
||||||
} |
|
||||||
public Builder mergeFrom(com.google.protobuf.Message other) { |
|
||||||
if (other instanceof Message.MessageBase) { |
|
||||||
return mergeFrom((Message.MessageBase)other); |
|
||||||
} else { |
|
||||||
super.mergeFrom(other); |
|
||||||
return this; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Builder mergeFrom(Message.MessageBase other) { |
|
||||||
if (other == Message.MessageBase.getDefaultInstance()) return this; |
|
||||||
if (other.hasClientId()) { |
|
||||||
bitField0_ |= 0x00000001; |
|
||||||
clientId_ = other.clientId_; |
|
||||||
onChanged(); |
|
||||||
} |
|
||||||
if (other.hasCmd()) { |
|
||||||
setCmd(other.getCmd()); |
|
||||||
} |
|
||||||
if (other.hasData()) { |
|
||||||
bitField0_ |= 0x00000004; |
|
||||||
data_ = other.data_; |
|
||||||
onChanged(); |
|
||||||
} |
|
||||||
this.mergeUnknownFields(other.unknownFields); |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public final boolean isInitialized() { |
|
||||||
if (!hasClientId()) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
if (!hasCmd()) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
public Builder mergeFrom( |
|
||||||
com.google.protobuf.CodedInputStream input, |
|
||||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
|
||||||
throws java.io.IOException { |
|
||||||
Message.MessageBase parsedMessage = null; |
|
||||||
try { |
|
||||||
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); |
|
||||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) { |
|
||||||
parsedMessage = (Message.MessageBase) e.getUnfinishedMessage(); |
|
||||||
throw e.unwrapIOException(); |
|
||||||
} finally { |
|
||||||
if (parsedMessage != null) { |
|
||||||
mergeFrom(parsedMessage); |
|
||||||
} |
|
||||||
} |
|
||||||
return this; |
|
||||||
} |
|
||||||
private int bitField0_; |
|
||||||
|
|
||||||
private Object clientId_ = ""; |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public boolean hasClientId() { |
|
||||||
return ((bitField0_ & 0x00000001) == 0x00000001); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public String getClientId() { |
|
||||||
Object ref = clientId_; |
|
||||||
if (!(ref instanceof String)) { |
|
||||||
com.google.protobuf.ByteString bs = |
|
||||||
(com.google.protobuf.ByteString) ref; |
|
||||||
String s = bs.toStringUtf8(); |
|
||||||
if (bs.isValidUtf8()) { |
|
||||||
clientId_ = s; |
|
||||||
} |
|
||||||
return s; |
|
||||||
} else { |
|
||||||
return (String) ref; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public com.google.protobuf.ByteString |
|
||||||
getClientIdBytes() { |
|
||||||
Object ref = clientId_; |
|
||||||
if (ref instanceof String) { |
|
||||||
com.google.protobuf.ByteString b = |
|
||||||
com.google.protobuf.ByteString.copyFromUtf8( |
|
||||||
(String) ref); |
|
||||||
clientId_ = b; |
|
||||||
return b; |
|
||||||
} else { |
|
||||||
return (com.google.protobuf.ByteString) ref; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public Builder setClientId( |
|
||||||
String value) { |
|
||||||
if (value == null) { |
|
||||||
throw new NullPointerException(); |
|
||||||
} |
|
||||||
bitField0_ |= 0x00000001; |
|
||||||
clientId_ = value; |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public Builder clearClientId() { |
|
||||||
bitField0_ = (bitField0_ & ~0x00000001); |
|
||||||
clientId_ = getDefaultInstance().getClientId(); |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required string clientId = 1;</code> |
|
||||||
*/ |
|
||||||
public Builder setClientIdBytes( |
|
||||||
com.google.protobuf.ByteString value) { |
|
||||||
if (value == null) { |
|
||||||
throw new NullPointerException(); |
|
||||||
} |
|
||||||
bitField0_ |= 0x00000001; |
|
||||||
clientId_ = value; |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
private int cmd_ = 1; |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
public boolean hasCmd() { |
|
||||||
return ((bitField0_ & 0x00000002) == 0x00000002); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
public Command.CommandType getCmd() { |
|
||||||
Command.CommandType result = Command.CommandType.valueOf(cmd_); |
|
||||||
return result == null ? Command.CommandType.AUTH : result; |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
public Builder setCmd(Command.CommandType value) { |
|
||||||
if (value == null) { |
|
||||||
throw new NullPointerException(); |
|
||||||
} |
|
||||||
bitField0_ |= 0x00000002; |
|
||||||
cmd_ = value.getNumber(); |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>required .CommandType cmd = 2;</code> |
|
||||||
*/ |
|
||||||
public Builder clearCmd() { |
|
||||||
bitField0_ = (bitField0_ & ~0x00000002); |
|
||||||
cmd_ = 1; |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
private Object data_ = ""; |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public boolean hasData() { |
|
||||||
return ((bitField0_ & 0x00000004) == 0x00000004); |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public String getData() { |
|
||||||
Object ref = data_; |
|
||||||
if (!(ref instanceof String)) { |
|
||||||
com.google.protobuf.ByteString bs = |
|
||||||
(com.google.protobuf.ByteString) ref; |
|
||||||
String s = bs.toStringUtf8(); |
|
||||||
if (bs.isValidUtf8()) { |
|
||||||
data_ = s; |
|
||||||
} |
|
||||||
return s; |
|
||||||
} else { |
|
||||||
return (String) ref; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public com.google.protobuf.ByteString |
|
||||||
getDataBytes() { |
|
||||||
Object ref = data_; |
|
||||||
if (ref instanceof String) { |
|
||||||
com.google.protobuf.ByteString b = |
|
||||||
com.google.protobuf.ByteString.copyFromUtf8( |
|
||||||
(String) ref); |
|
||||||
data_ = b; |
|
||||||
return b; |
|
||||||
} else { |
|
||||||
return (com.google.protobuf.ByteString) ref; |
|
||||||
} |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public Builder setData( |
|
||||||
String value) { |
|
||||||
if (value == null) { |
|
||||||
throw new NullPointerException(); |
|
||||||
} |
|
||||||
bitField0_ |= 0x00000004; |
|
||||||
data_ = value; |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public Builder clearData() { |
|
||||||
bitField0_ = (bitField0_ & ~0x00000004); |
|
||||||
data_ = getDefaultInstance().getData(); |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
/** |
|
||||||
* <code>optional string data = 3;</code> |
|
||||||
*/ |
|
||||||
public Builder setDataBytes( |
|
||||||
com.google.protobuf.ByteString value) { |
|
||||||
if (value == null) { |
|
||||||
throw new NullPointerException(); |
|
||||||
} |
|
||||||
bitField0_ |= 0x00000004; |
|
||||||
data_ = value; |
|
||||||
onChanged(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
public final Builder setUnknownFields( |
|
||||||
final com.google.protobuf.UnknownFieldSet unknownFields) { |
|
||||||
return super.setUnknownFields(unknownFields); |
|
||||||
} |
|
||||||
|
|
||||||
public final Builder mergeUnknownFields( |
|
||||||
final com.google.protobuf.UnknownFieldSet unknownFields) { |
|
||||||
return super.mergeUnknownFields(unknownFields); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
// @@protoc_insertion_point(builder_scope:MessageBase)
|
|
||||||
} |
|
||||||
|
|
||||||
// @@protoc_insertion_point(class_scope:MessageBase)
|
|
||||||
private static final Message.MessageBase DEFAULT_INSTANCE; |
|
||||||
static { |
|
||||||
DEFAULT_INSTANCE = new Message.MessageBase(); |
|
||||||
} |
|
||||||
|
|
||||||
public static Message.MessageBase getDefaultInstance() { |
|
||||||
return DEFAULT_INSTANCE; |
|
||||||
} |
|
||||||
|
|
||||||
@Deprecated public static final com.google.protobuf.Parser<MessageBase> |
|
||||||
PARSER = new com.google.protobuf.AbstractParser<MessageBase>() { |
|
||||||
public MessageBase parsePartialFrom( |
|
||||||
com.google.protobuf.CodedInputStream input, |
|
||||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
|
||||||
throws com.google.protobuf.InvalidProtocolBufferException { |
|
||||||
return new MessageBase(input, extensionRegistry); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
public static com.google.protobuf.Parser<MessageBase> parser() { |
|
||||||
return PARSER; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public com.google.protobuf.Parser<MessageBase> getParserForType() { |
|
||||||
return PARSER; |
|
||||||
} |
|
||||||
|
|
||||||
public Message.MessageBase getDefaultInstanceForType() { |
|
||||||
return DEFAULT_INSTANCE; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private static final com.google.protobuf.Descriptors.Descriptor |
|
||||||
internal_static_MessageBase_descriptor; |
|
||||||
private static final |
|
||||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
|
||||||
internal_static_MessageBase_fieldAccessorTable; |
|
||||||
|
|
||||||
public static com.google.protobuf.Descriptors.FileDescriptor |
|
||||||
getDescriptor() { |
|
||||||
return descriptor; |
|
||||||
} |
|
||||||
private static com.google.protobuf.Descriptors.FileDescriptor |
|
||||||
descriptor; |
|
||||||
static { |
|
||||||
String[] descriptorData = { |
|
||||||
"\n\rMessage.proto\032\rCommand.proto\"H\n\013Messag" + |
|
||||||
"eBase\022\020\n\010clientId\030\001 \002(\t\022\031\n\003cmd\030\002 \002(\0162\014.C" + |
|
||||||
"ommandType\022\014\n\004data\030\003 \001(\tB$\n\031com.netty.co" + |
|
||||||
"mmon.protobufB\007Message" |
|
||||||
}; |
|
||||||
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[] { |
|
||||||
Command.getDescriptor(), |
|
||||||
}, assigner); |
|
||||||
internal_static_MessageBase_descriptor = |
|
||||||
getDescriptor().getMessageTypes().get(0); |
|
||||||
internal_static_MessageBase_fieldAccessorTable = new |
|
||||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( |
|
||||||
internal_static_MessageBase_descriptor, |
|
||||||
new String[] { "ClientId", "Cmd", "Data", }); |
|
||||||
Command.getDescriptor(); |
|
||||||
} |
|
||||||
|
|
||||||
// @@protoc_insertion_point(outer_class_scope)
|
|
||||||
} |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
syntax = "proto2"; |
|
||||||
|
|
||||||
option java_package="cn.myzf.common.protobuf"; |
|
||||||
option java_outer_classname = "Message"; |
|
||||||
import "cn/myzf/common/protobuf/Command.proto"; |
|
||||||
|
|
||||||
message MessageBase { |
|
||||||
required string clientId = 1; |
|
||||||
required CommandType cmd = 2; |
|
||||||
optional string data = 3; |
|
||||||
} |
|
||||||
Loading…
Reference in new issue