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 | import java.nio.ByteOrder; |
| 5 | import java.util.List; |
| 6 | |
| 7 | /** |
| 8 | * Permission bits and extended attributes for a file. |
| 9 | * |
| 10 | * <p>Reference: {@code ostree-core.h#OSTREE_FILEMETA_GVARIANT_STRING} |
| 11 | */ |
| 12 | public record FileMeta(int uid, int gid, int mode, List<Xattr> xattrs) { |
| 13 | |
| 14 | private static final Decoder<FileMeta> DECODER = |
| 15 | Decoder.ofStructure( |
| 16 | FileMeta.class, |
| 17 | Decoder.ofInt().withByteOrder(ByteOrder.BIG_ENDIAN), |
| 18 | Decoder.ofInt().withByteOrder(ByteOrder.BIG_ENDIAN), |
| 19 | Decoder.ofInt().withByteOrder(ByteOrder.BIG_ENDIAN), |
| 20 | Decoder.ofArray(Xattr.decoder())); |
| 21 | |
| 22 | public static Decoder<FileMeta> decoder() { |
| 23 | return DECODER; |
| 24 | } |
| 25 | } |