Looks like I have finally figured out when to throw IOException.