return new Function<ByteBuffer, T>() {
@Nullable
@Override
public T apply(ByteBuffer input) {
byteBufferInput.reset(input);
try {
final Schema sourceSchema = schemaCache.get(input);
Preconditions.checkNotNull(sourceSchema, "Fail to find source schema.");
return datumReader.read(decoder, sourceSchema);
} catch (IOException e) {