Matthias Andreas Benkard | b5d657a | 2022-02-03 21:14:30 +0100 | [diff] [blame^] | 1 | // SPDX-FileCopyrightText: © 2021 Matthias Andreas Benkard <code@mail.matthias.benkard.de> |
| 2 | // |
| 3 | // SPDX-License-Identifier: LGPL-3.0-or-later |
| 4 | |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 5 | package eu.mulk.jgvariant.ostree; |
| 6 | |
| 7 | import eu.mulk.jgvariant.core.Decoder; |
| 8 | |
| 9 | /** |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 10 | * A POSIX extended attribute of a file or directory. |
| 11 | * |
| 12 | * <p>Reference: (embedded in other data types, e.g. {@code |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 13 | * ostree-core.h#OSTREE_DIRMETA_GVARIANT_STRING}, {@code |
| 14 | * ostree-core.h#OSTREE_FILEMETA_GVARIANT_STRING}) |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 15 | * |
| 16 | * @param name the name part of the extended attribute. |
| 17 | * @param value the value part of the extended attribute. |
| 18 | * @see DirMeta |
| 19 | * @see FileMeta |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 20 | */ |
| 21 | public record Xattr(ByteString name, ByteString value) { |
| 22 | |
| 23 | private static final Decoder<Xattr> DECODER = |
| 24 | Decoder.ofStructure(Xattr.class, ByteString.decoder(), ByteString.decoder()); |
| 25 | |
Matthias Andreas Benkard | 0511464 | 2021-12-29 21:51:29 +0100 | [diff] [blame] | 26 | /** |
| 27 | * Acquires a {@link Decoder} for the enclosing type. |
| 28 | * |
| 29 | * @return a possibly shared {@link Decoder}. |
| 30 | */ |
Matthias Andreas Benkard | 4e8423d | 2021-12-19 22:56:09 +0100 | [diff] [blame] | 31 | public static Decoder<Xattr> decoder() { |
| 32 | return DECODER; |
| 33 | } |
| 34 | } |