DeletableFrameTupleAppender implements IAppendDeletableFrameTupleAccessor { @Override public int append(IFrameTupleAccessor tupleAccessor, int tIndex) throws HyracksDataException { byte[] src = tupleAccessor.getBuffer().array(); int tStartOffset = tupleAccessor.getTupleStartOffset(tIndex); int length = tupleAccessor.getTupleLength(tIndex); System.arraycopy(src, tStartOffset, array, freeDataEndOffset, length); setTupleCount(++tupleCount); freeDataEndOffset += length; setFreeDataEndOffset(freeDataEndOffset); return tupleCount - 1; } DeletableFrameTupleAppender(RecordDescriptor recordDescriptor); @Override void clear(ByteBuffer buffer); @Override void reset(ByteBuffer buffer); @Override int append(IFrameTupleAccessor tupleAccessor, int tIndex); @Override void delete(int tupleIndex); @Override void reOrganizeBuffer(); @Override int getTotalFreeSpace(); @Override int getContiguousFreeSpace(); @Override int getFieldCount(); @Override int getFieldSlotsLength(); @Override int getFieldEndOffset(int tupleIndex, int fIdx); @Override int getFieldStartOffset(int tupleIndex, int fIdx); @Override int getFieldLength(int tupleIndex, int fIdx); @Override int getTupleLength(int tupleIndex); @Override int getTupleEndOffset(int tupleIndex); @Override int getTupleStartOffset(int tupleIndex); @Override int getAbsoluteFieldStartOffset(int tupleIndex, int fIdx); @Override int getTupleCount(); @Override ByteBuffer getBuffer();  }
@Test public void testAppend() throws Exception { int count = 10; ByteBuffer bufferRead = makeAFrame(cap, count, 0); DeletableFrameTupleAppender accessor = new DeletableFrameTupleAppender(recordDescriptor); accessor.reset(bufferRead); ByteBuffer bufferWrite = ByteBuffer.allocate(cap); appender.clear(bufferWrite); for (int i = 0; i < accessor.getTupleCount(); i++) { appender.append(accessor, i); } for (int i = 0; i < bufferRead.capacity(); i++) { assertEquals(bufferRead.get(i), bufferWrite.get(i)); } }