static <T, EX extends Exception> @NotNull BinaryTagHolder encode(final @NotNull T nbt, final @NotNull Codec<? super T, String, ?, EX> codec) throws EX {
    return new BinaryTagHolderImpl(codec.encode(nbt));
  }
Encodes {@code nbt} using {@code codec}.

@param nbt the binary tag
@param codec the codec
@param <T> the binary tag type
@param <EX> encode exception type
@return the encoded binary tag holder
@throws EX if an error occurred while encoding the binary tag
@since 4.0.0
api/src/main/java/net/kyori/adventure/nbt/api/BinaryTagHolder.java