Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 1 | package eu.mulk.jgvariant.ostree; |
| 2 | |
| 3 | import eu.mulk.jgvariant.core.Decoder; |
| 4 | |
| 5 | /** |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 6 | * A POSIX extended attribute of a file or directory. |
| 7 | * |
| 8 | * <p>Reference: (embedded in other data types, e.g. {@code |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 9 | * ostree-core.h#OSTREE_DIRMETA_GVARIANT_STRING}, {@code |
| 10 | * ostree-core.h#OSTREE_FILEMETA_GVARIANT_STRING}) |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 11 | * |
| 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 Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 16 | */ |
| 17 | public 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 Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 22 | /** |
| 23 | * Acquires a {@link Decoder} for the enclosing type. |
| 24 | * |
| 25 | * @return a possibly shared {@link Decoder}. |
| 26 | */ |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 27 | public static Decoder<Xattr> decoder() { |
| 28 | return DECODER; |
| 29 | } |
| 30 | } |