Should this be `fileSegment.length < file.length()`, in the case where we're trying to delete only part of a file?

Would the current case, where the file is shorter than the segment, correspond to a write that failed?