WriteHeaderLength 写入Header长度数据
(headerLength int)
| 54 | |
| 55 | // WriteHeaderLength 写入Header长度数据 |
| 56 | func (this *FileWriter) WriteHeaderLength(headerLength int) error { |
| 57 | if this.metaHeaderSize > 0 && this.metaHeaderSize == headerLength { |
| 58 | return nil |
| 59 | } |
| 60 | var bytes4 = make([]byte, 4) |
| 61 | binary.BigEndian.PutUint32(bytes4, uint32(headerLength)) |
| 62 | _, err := this.rawWriter.Seek(SizeExpiresAt+SizeStatus+SizeURLLength, io.SeekStart) |
| 63 | if err != nil { |
| 64 | _ = this.Discard() |
| 65 | return err |
| 66 | } |
| 67 | _, err = this.rawWriter.Write(bytes4) |
| 68 | if err != nil { |
| 69 | _ = this.Discard() |
| 70 | return err |
| 71 | } |
| 72 | return nil |
| 73 | } |
| 74 | |
| 75 | // Write 写入数据 |
| 76 | func (this *FileWriter) Write(data []byte) (n int, err error) { |