private void initTmpBBuf() throws NoSuchFieldException, IllegalAccessException { // patch MallocBytes such that it points to a DirectByteBuffer (allows zerocopy using fst bytez utils) tmpSend = ByteBuffer.allocateDirect(0); Field address = null; Field capacity = null; List<Field> fields = new ArrayList<>(); FSTUtil.getAllFields(fields, tmpSend.getClass()); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); if ( field.getName().equals("address") ) { address = field; } else if ( field.getName().equals("capacity") ) { capacity = field; } } address.setAccessible(true); capacity.setAccessible(true); MallocBytez base = (MallocBytez) history.getBase(); address.setLong(tmpSend, base.getBaseAdress() + history.getOffset()); capacity.setInt(tmpSend, history.getByteSize()); }
private void initTmpBBuf() throws NoSuchFieldException, IllegalAccessException { // patch MallocBytes such that it points to a DirectByteBuffer (allows zerocopy using fst bytez utils) tmpSend = ByteBuffer.allocateDirect(0); Field address = null; Field capacity = null; List<Field> fields = new ArrayList<>(); FSTUtil.getAllFields(fields, tmpSend.getClass()); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); if ( field.getName().equals("address") ) { address = field; } else if ( field.getName().equals("capacity") ) { capacity = field; } } address.setAccessible(true); capacity.setAccessible(true); MallocBytez base = (MallocBytez) history.getBase(); address.setLong(tmpSend, base.getBaseAdress() + history.getOffset()); capacity.setInt(tmpSend, history.getByteSize()); }