List of usage examples for io.netty.buffer ByteBuf slice
public abstract ByteBuf slice();
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComQueryRequestMessage.java
License:Open Source License
@Override public MSPComQueryRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComQueryRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComQuitRequestMessage.java
License:Open Source License
@Override public MSPComQuitRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComQuitRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComSetOptionRequestMessage.java
License:Open Source License
@Override public MSPComSetOptionRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComSetOptionRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComStatisticsRequestMessage.java
License:Open Source License
@Override public MSPComStatisticsRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComStatisticsRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComStmtCloseRequestMessage.java
License:Open Source License
@Override public MSPComStmtCloseRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComStmtCloseRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComStmtExecuteRequestMessage.java
License:Open Source License
@Override public MSPComStmtExecuteRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComStmtExecuteRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPServerGreetingRequestMessage.java
License:Open Source License
@Override public MSPServerGreetingRequestMessage newPrototype(ByteBuf source) { final byte messageType = source.readByte(); source = source.slice(); return new MSPServerGreetingRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPUnknown.java
License:Open Source License
@Override public MSPUnknown newPrototype(ByteBuf source) { source = source.slice(); return new MSPUnknown(source); }
From source file:com.tesora.dve.mysqlapi.repl.messages.MyReplEvent.java
License:Open Source License
@Override public void unmarshallMessage(ByteBuf cb) throws PEException { //assumes the provided buffer is already scoped to payload boundary. rawPayload = cb.slice().copy(); // 19 bytes for the common header commonHdr = new MyReplEventCommonHeader(); commonHdr.setTimestamp(cb.readUnsignedInt()); commonHdr.setType(cb.readByte());/*from ww w .ja v a 2s .co m*/ commonHdr.setServerId(cb.readUnsignedInt()); commonHdr.setTotalSize(cb.readUnsignedInt()); commonHdr.setMasterLogPosition(cb.readUnsignedInt()); commonHdr.setFlags(cb.readShort()); // unmarshall message based on common header type if (logger.isDebugEnabled()) logger.debug("Unmarshalling event of type: " + MyLogEventType.fromByte(commonHdr.getType()).name()); levp = MyLogEventPacket.MySqlLogEventFactory.newInstance(MyLogEventType.fromByte(commonHdr.getType()), commonHdr); levp.unmarshallMessage(cb); }
From source file:io.gomint.proxprox.network.tcp.PacketDecompressor.java
License:BSD License
@Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { int size = in.readInt(); if (size == 0) { out.add(in.slice().retain()); in.skipBytes(in.readableBytes()); } else {// ww w. java 2 s . c o m ByteBuf decompressed = ctx.alloc().directBuffer(); try { zlib.process(in, decompressed); Preconditions.checkState(decompressed.readableBytes() == size, "Decompressed packet size mismatch"); out.add(decompressed); decompressed = null; } finally { if (decompressed != null) { decompressed.release(); } } } }