io.datakernel.codec.StructuredDecoder Maven / Gradle / Ivy
package io.datakernel.codec;
import io.datakernel.common.parse.ParseException;
import java.util.function.Supplier;
/**
* Encorer can read an object of type T from a {@link StructuredInput}.
*/
public interface StructuredDecoder {
T decode(StructuredInput in) throws ParseException;
static StructuredDecoder ofObject(StructuredDecoder decoder) {
return in -> in.readObject(decoder);
}
static StructuredDecoder ofObject(Supplier supplier) {
return ofObject(in -> supplier.get());
}
static StructuredDecoder ofTuple(StructuredDecoder decoder) {
return in -> in.readTuple(decoder);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy