com.github.bloodshura.ignitium.ntv.struct.CommonStructField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ignitium-native Show documentation
Show all versions of ignitium-native Show documentation
An API for working with native system APIs, with a higher-level interface.
The newest version!
package com.github.bloodshura.ignitium.ntv.struct;
import javax.annotation.Nonnull;
import java.util.function.BiConsumer;
import java.util.function.Function;
public class CommonStructField extends MutableStructField {
private final Function reader;
private final BiConsumer writer;
public CommonStructField(@Nonnull MappedStruct struct, int offset, int size, @Nonnull Function reader, @Nonnull BiConsumer writer) {
super(struct, offset, size);
this.reader = reader;
this.writer = writer;
}
@Nonnull
@Override
protected E read() {
return reader.apply(getOffset());
}
@Override
protected void write(@Nonnull E value) {
writer.accept(getOffset(), value);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy