@Override
@Nonnegative
public DeleteMessage decode(ByteBuf buffer, RequestBaseMessage requestBaseMessage) throws
InvalidNamespaceException, InvalidBsonException {
try {
MyBsonContext context = new MyBsonContext(buffer);
buffer.skipBytes(4);
String fullCollectionName = stringReader.readCString(buffer, true);
int flags = buffer.readInt();
BsonDocument document = docReader.readDocument(HEAP, buffer);
String database = getDatabase(fullCollectionName).intern();
String collection = getCollection(fullCollectionName).intern();
return new DeleteMessage(
requestBaseMessage,
context,
database,
collection,
document,
EnumInt32FlagsUtil.isActive(Flag.SINGLE_REMOVE, flags)
);
} catch (NettyBsonReaderException ex) {
throw new InvalidBsonException(ex);
}
}