IntFileAttributeAccessor (@NotNull FSRecordsImpl vfs, @NotNull FileAttribute attribute) { return new IntFileAttributeAccessor() { @Override public void close() { // noop } @Override public int read(int fileId, int defaultValue) { Integer value = vfs.readAttributeRaw(fileId, attribute, buffer -> { //stream.writeInt() writes in BIG_ENDIAN (default byte order for JVM) return buffer.order(BIG_ENDIAN).getInt(); }); return value == null ? defaultValue : value.intValue(); } @Override public void write(int fileId, int value) throws IOException { try (var stream = vfs.writeAttribute(fileId, attribute)) { stream.writeInt(value); } //vfs.writeAttributeRaw(fileId, attribute, buffer -> { // if (attribute.isVersioned()) { // buffer.putInt(attribute.getVersion()); // } // return buffer.putInt(value); //}); } @Override public void update(int fileId, @NotNull IntUnaryOperator updater) throws IOException { throw new UnsupportedOperationException("Method not implemented yet"); } }; }