blob: 7f05cf6840b9974c6185af0f52613cdf36cb4803 [file] [log] [blame]
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +01001package eu.mulk.jgvariant.ostree;
2
3import eu.mulk.jgvariant.core.Decoder;
4
5/**
Matthias Andreas Benkard05114642021-12-29 21:51:29 +01006 * A POSIX extended attribute of a file or directory.
7 *
8 * <p>Reference: (embedded in other data types, e.g. {@code
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +01009 * ostree-core.h#OSTREE_DIRMETA_GVARIANT_STRING}, {@code
10 * ostree-core.h#OSTREE_FILEMETA_GVARIANT_STRING})
Matthias Andreas Benkard05114642021-12-29 21:51:29 +010011 *
12 * @param name the name part of the extended attribute.
13 * @param value the value part of the extended attribute.
14 * @see DirMeta
15 * @see FileMeta
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +010016 */
17public record Xattr(ByteString name, ByteString value) {
18
19 private static final Decoder<Xattr> DECODER =
20 Decoder.ofStructure(Xattr.class, ByteString.decoder(), ByteString.decoder());
21
Matthias Andreas Benkard05114642021-12-29 21:51:29 +010022 /**
23 * Acquires a {@link Decoder} for the enclosing type.
24 *
25 * @return a possibly shared {@link Decoder}.
26 */
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +010027 public static Decoder<Xattr> decoder() {
28 return DECODER;
29 }
30}