/** * Add an entry asynchronously to an open ledger. * * @param data array of bytes to be written * @param offset the offset in the bytes array * @param length the length of the bytes to be appended * @return a completable future represents the add result, in case of success the future returns the entry id * of this newly appended entry */ default CompletableFuture<Long> appendAsync(byte[] data, int offset, int length) { return appendAsync(Unpooled.wrappedBuffer(data, offset, length)); }
/** * Add an entry asynchronously to an open ledger. * * @param data array of bytes to be written * @return a completable future represents the add result, in case of success the future returns the entry id * of this newly appended entry */ default CompletableFuture<Long> appendAsync(byte[] data) { return appendAsync(Unpooled.wrappedBuffer(data)); }
/** * Add entry asynchronously to an open ledger. * * @param data array of bytes to be written * @return an handle to the result, in case of success it will return the id of the newly appended entry */ default CompletableFuture<Long> appendAsync(ByteBuffer data) { return appendAsync(Unpooled.wrappedBuffer(data)); }
/** * Add entry synchronously to an open ledger. * * @param data a bytebuf to be written. The bytebuf's reference count will be decremented by 1 after the * call completes. * @return the id of the newly appended entry */ default long append(ByteBuf data) throws BKException, InterruptedException { return FutureUtils.<Long, BKException>result(appendAsync(data), BKException.HANDLER); }