Parameterize generic type and close inputstream
Parameterize generic type