generate asReader method