Incorrectly had int instead of long for offset. Large files failed due to this.