NewNgWriterInterface initializes and returns a new writer. Additionally, one section and one interface (without statistics) is written to the file. Flush must be called before the file is closed, or if eventual unwritten information should be written out to the storage device. Written files are in
(w io.Writer, intf NgInterface, options NgWriterOptions)
| 64 | // |
| 65 | // Written files are in little endian format. Interface timestamp resolution is fixed to 9 (to match time.Time). |
| 66 | func NewNgWriterInterface(w io.Writer, intf NgInterface, options NgWriterOptions) (*NgWriter, error) { |
| 67 | ret := &NgWriter{ |
| 68 | w: bufio.NewWriter(w), |
| 69 | options: options, |
| 70 | } |
| 71 | if err := ret.writeSectionHeader(); err != nil { |
| 72 | return nil, err |
| 73 | } |
| 74 | |
| 75 | if _, err := ret.AddInterface(intf); err != nil { |
| 76 | return nil, err |
| 77 | } |
| 78 | return ret, nil |
| 79 | } |
| 80 | |
| 81 | // ngOptionLength returns the needed length for one option value (without padding) |
| 82 | func ngOptionLength(option ngOption) int { |
searching dependent graphs…