Right. Wrap in a try/finally to close the stream if the reading part throws the IOException.