All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.datakernel.codec.StructuredDecoder Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
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 - 2024 Weber Informatics LLC | Privacy Policy