List of usage examples for io.netty.buffer ByteBuf slice
public abstract ByteBuf slice();
From source file:com.tesora.dve.db.mysql.libmy.MyBinaryResultRow.java
License:Open Source License
public MyBinaryResultRow projection(int[] desiredFields) { int expectedFieldCount = desiredFields.length; ArrayList<ByteBuf> newSlices = new ArrayList<>(expectedFieldCount); ArrayList<DecodedMeta> newConverters = new ArrayList<>(expectedFieldCount); for (int targetIndex = 0; targetIndex < expectedFieldCount; targetIndex++) { int sourceIndex = desiredFields[targetIndex]; newConverters.add(fieldConverters.get(sourceIndex));//use the source index, not the target index.. if (fieldSlices.get(sourceIndex) == null) { newSlices.add(null);// ww w. j a v a2 s . c o m } else { ByteBuf fieldSlice = fieldSlices.get(sourceIndex); ByteBuf copySlice = Unpooled.buffer(fieldSlice.readableBytes()).order(ByteOrder.LITTLE_ENDIAN); copySlice.writeBytes(fieldSlice.slice()); newSlices.add(copySlice); } } return new MyBinaryResultRow(newConverters, newSlices); }
From source file:com.tesora.dve.db.mysql.libmy.MyBinaryResultRow.java
License:Open Source License
public ByteBuf getSlice(int itemNumber) { ByteBuf field = fieldSlices.get(itemNumber); if (field == null) return null; else/* w w w. j a v a 2 s . co m*/ return field.slice(); }
From source file:com.tesora.dve.db.mysql.libmy.MyHandshakeErrorResponse.java
License:Open Source License
@Override public void unmarshallMessage(ByteBuf cb) { cb.readByte(); setErrorNumber(cb.readShort()); setErrorMsg(cb.slice().toString(charset)); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPAuthenticateV10MessageMessage.java
License:Open Source License
public static MSPAuthenticateV10MessageMessage newMessage(ByteBuf backing) { return new MSPAuthenticateV10MessageMessage(backing.slice()); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPAuthenticateV10MessageMessage.java
License:Open Source License
@Override public MSPAuthenticateV10MessageMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPAuthenticateV10MessageMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComFieldListRequestMessage.java
License:Open Source License
@Override public MSPComFieldListRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComFieldListRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComInitDBRequestMessage.java
License:Open Source License
@Override public MSPComInitDBRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComInitDBRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComPingRequestMessage.java
License:Open Source License
@Override public MSPComPingRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComPingRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComPrepareStmtRequestMessage.java
License:Open Source License
@Override public MSPComPrepareStmtRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComPrepareStmtRequestMessage(source); }
From source file:com.tesora.dve.db.mysql.portal.protocol.MSPComProcessInfoRequestMessage.java
License:Open Source License
@Override public MSPComProcessInfoRequestMessage newPrototype(ByteBuf source) { source = source.slice(); return new MSPComProcessInfoRequestMessage(source); }