如何将 ByteIterable 转换为字符串?

How to convert a ByteIterable into a String?

当我放一个键时,我使用StringToEntry:

store.put(txn, StringBinding.stringToEntry(key), StringBinding.stringToEntry(value));

当我 return 它时,我得到一个 ByteIterable:

ByteIterable result = store2.get(txn2, StringBinding.stringToEntry("bn:14271053n"));

如何将其转换为字符串?

环境文档的 Bindings 部分说:

All inheritors of the ComparableBinding class contain two static methods: one for getting the ByteIterable entry from a value, and another for getting value from an entry. For example, ByteBinding contains the following methods:

public static byte entryToByte(@NotNull final ByteIterable entry);

public static ArrayByteIterable byteToEntry(final byte object);

同样,StringBinding也包含两个方法,需要的方法是

public static String entryToString(@NotNull final ByteIterable entry);