/** * Add entry synchronously to an open ledger. * * @param entryId entryId to be added. * @param data array of bytes to be written * @return same value of param {@code entryId}. */ default long write(final long entryId, final byte[] data) throws BKException, InterruptedException { return write(entryId, Unpooled.wrappedBuffer(data)); }
/** * Add entry asynchronously to an open ledger. * * @param entryId entryId to be added. * @param data array of bytes to be written * @param offset the offset of the bytes array * @param length the length to data to write * @return an handle to the result, in case of success it will return the same value of param {@code entryId}. */ default CompletableFuture<Long> writeAsync(final long entryId, final byte[] data, int offset, int length) { return writeAsync(entryId, Unpooled.wrappedBuffer(data, offset, length)); }
/** * Add entry asynchronously to an open ledger. * * @param entryId entryId to be added * @param data array of bytes to be written * @return an handle to the result, in case of success it will return the same value of param entryId. */ default CompletableFuture<Long> writeAsync(final long entryId, final ByteBuffer data) { return writeAsync(entryId, Unpooled.wrappedBuffer(data)); }
/** * Add entry synchronously to an open ledger. * * @param entryId entryId to be added * @param data array of bytes to be written * @return the same value of param entryId. */ default long write(final long entryId, final ByteBuffer data) throws BKException, InterruptedException { return write(entryId, Unpooled.wrappedBuffer(data)); }
/** * Add entry asynchronously to an open ledger. * * @param entryId entryId to be added. * @param data array of bytes to be written * @return an handle to the result, in case of success it will return the same value of param {@code entryId}. */ default CompletableFuture<Long> writeAsync(final long entryId, final byte[] data) { return writeAsync(entryId, Unpooled.wrappedBuffer(data)); }
/** * Add entry synchronously to an open ledger. * * @param entryId entryId to be added. * @param data array of bytes to be written * @param offset the offset of the bytes array * @param length the length to data to write * @return the same value of param {@code entryId}. */ default long write(final long entryId, final byte[] data, int offset, int length) throws BKException, InterruptedException { return write(entryId, Unpooled.wrappedBuffer(data, offset, length)); }
/** * Add entry asynchronously to an open ledger. * * @param entryId entryId to be added * @param data array of bytes to be written * @return the same value of param entryId */ default long write(long entryId, ByteBuf data) throws BKException, InterruptedException { return FutureUtils.<Long, BKException>result(writeAsync(entryId, data), BKException.HANDLER); } }