Use callback for reading inputstream