com.google.protobuf.GeneratedMessageV3.Builder Java Examples
The following examples show how to use
com.google.protobuf.GeneratedMessageV3.Builder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DFJsActor.java From dfactor with MIT License | 6 votes |
@Override public boolean tcpSend(Integer channelId, Object msg) { if(_mapChJsFunc != null){ JsTcpChannel ch = _mapChJsFunc.get(channelId); if(ch != null){ //online Object msgOut = msg; if(msg instanceof IScriptBuffer){ //trans to bytebuf msgOut = ((DFJsBuffer)msg).getBuf(); }else if(msg instanceof Builder){ //protobuf builder byte[] bytes = ((Builder<?>)msg).build().toByteArray(); int len = bytes.length; msgOut = PooledByteBufAllocator.DEFAULT.ioBuffer(len); ((ByteBuf)msgOut).writeBytes(bytes); } return ch.channel.write(msgOut)==0?true:false; } } return false; }
Example #2
Source File: DFJsActor.java From dfactor with MIT License | 5 votes |
@Override public IScriptBuffer protoToBuf(Builder<?> builder) { try{ byte[] bytes = builder.build().toByteArray(); ByteBuf buf = UnpooledByteBufAllocator.DEFAULT.heapBuffer(bytes.length); buf.writeBytes(bytes); IScriptBuffer bufOut = DFJsBuffer.newBuffer(buf); return bufOut; }catch(Throwable e){ e.printStackTrace(); } return null; }
Example #3
Source File: IScriptAPI.java From dfactor with MIT License | votes |
public IScriptBuffer protoToBuf(Builder<?> builder);