| 61 | } |
| 62 | |
| 63 | func (this *FileWriter) WriteBodyAt(b []byte, offset int64) (n int, err error) { |
| 64 | if !this.hasMeta { |
| 65 | err = errors.New("no meta found") |
| 66 | return |
| 67 | } |
| 68 | |
| 69 | if !this.isPartial { |
| 70 | err = errors.New("can not write body at specified offset: it is not a partial file") |
| 71 | return |
| 72 | } |
| 73 | |
| 74 | // still 'Write()' NOT 'WriteAt()' |
| 75 | this.originOffset = offset |
| 76 | n, err = this.bFile.Write(this.hash, BlockTypeBody, b, offset) |
| 77 | this.originOffset += int64(n) |
| 78 | return |
| 79 | } |
| 80 | |
| 81 | func (this *FileWriter) Close() error { |
| 82 | defer func() { |