1 // This file was generated using `godoc` and customized for use with the 2 // API Reference documentation. To recreate this file, use the `godoc` tool 3 // (http://godoc.org) with the files in the `flatbuffers/go` folder. 4 // 5 // Note: You may need to ensure that copies of the files exist in the 6 // `src/` subfolder at the path set by the `$GOROOT` environment variable. 7 // You can either move the files to `$GOROOT/src/flatbuffers` manually, if 8 // `$GOROOT` is already set, otherwise you will need to manually set the 9 // `$GOROOT` variable to a path and create `src/flatbuffers` subfolders at that 10 // path. Then copy these files into `$GOROOT/src/flatbuffers`. (Some versions of 11 // `godoc` include a `-path` flag. This could be used instead, if available). 12 // 13 // Once the files exist at the `$GOROOT/src/flatbuffers` location, you can 14 // regenerate this doc using the following command: 15 // `godoc flatbuffers > GoApi_generated.txt`. 16 // 17 // After the documentation is generated, you will have to manually remove any 18 // non-user facing documentation from this file. 19 20 /// [Go API] 21 PACKAGE DOCUMENTATION 22 23 package flatbuffers 24 Package flatbuffers provides facilities to read and write flatbuffers 25 objects. 26 27 TYPES 28 29 type Builder struct { 30 // `Bytes` gives raw access to the buffer. Most users will want to use 31 // FinishedBytes() instead. 32 Bytes []byte 33 } 34 Builder is a state machine for creating FlatBuffer objects. Use a 35 Builder to construct object(s) starting from leaf nodes. 36 37 A Builder constructs byte buffers in a last-first manner for simplicity 38 and performance. 39 40 FUNCTIONS 41 42 func NewBuilder(initialSize int) *Builder 43 NewBuilder initializes a Builder of size `initial_size`. The internal 44 buffer is grown as needed. 45 46 func (b *Builder) CreateByteString(s []byte) UOffsetT 47 CreateByteString writes a byte slice as a string (null-terminated). 48 49 func (b *Builder) CreateByteVector(v []byte) UOffsetT 50 CreateByteVector writes a ubyte vector 51 52 func (b *Builder) CreateString(s string) UOffsetT 53 CreateString writes a null-terminated string as a vector. 54 55 func (b *Builder) EndVector(vectorNumElems int) UOffsetT 56 EndVector writes data necessary to finish vector construction. 57 58 func (b *Builder) Finish(rootTable UOffsetT) 59 Finish finalizes a buffer, pointing to the given `rootTable`. 60 61 func (b *Builder) FinishedBytes() []byte 62 FinishedBytes returns a pointer to the written data in the byte buffer. 63 Panics if the builder is not in a finished state (which is caused by 64 calling `Finish()`). 65 66 func (b *Builder) Head() UOffsetT 67 Head gives the start of useful data in the underlying byte buffer. Note: 68 unlike other functions, this value is interpreted as from the left. 69 70 func (b *Builder) PrependBool(x bool) 71 PrependBool prepends a bool to the Builder buffer. Aligns and checks for 72 space. 73 74 func (b *Builder) PrependByte(x byte) 75 PrependByte prepends a byte to the Builder buffer. Aligns and checks for 76 space. 77 78 func (b *Builder) PrependFloat32(x float32) 79 PrependFloat32 prepends a float32 to the Builder buffer. Aligns and 80 checks for space. 81 82 func (b *Builder) PrependFloat64(x float64) 83 PrependFloat64 prepends a float64 to the Builder buffer. Aligns and 84 checks for space. 85 86 func (b *Builder) PrependInt16(x int16) 87 PrependInt16 prepends a int16 to the Builder buffer. Aligns and checks 88 for space. 89 90 func (b *Builder) PrependInt32(x int32) 91 PrependInt32 prepends a int32 to the Builder buffer. Aligns and checks 92 for space. 93 94 func (b *Builder) PrependInt64(x int64) 95 PrependInt64 prepends a int64 to the Builder buffer. Aligns and checks 96 for space. 97 98 func (b *Builder) PrependInt8(x int8) 99 PrependInt8 prepends a int8 to the Builder buffer. Aligns and checks for 100 space. 101 102 func (b *Builder) PrependUOffsetT(off UOffsetT) 103 PrependUOffsetT prepends an UOffsetT, relative to where it will be 104 written. 105 106 func (b *Builder) PrependUint16(x uint16) 107 PrependUint16 prepends a uint16 to the Builder buffer. Aligns and checks 108 for space. 109 110 func (b *Builder) PrependUint32(x uint32) 111 PrependUint32 prepends a uint32 to the Builder buffer. Aligns and checks 112 for space. 113 114 func (b *Builder) PrependUint64(x uint64) 115 PrependUint64 prepends a uint64 to the Builder buffer. Aligns and checks 116 for space. 117 118 func (b *Builder) PrependUint8(x uint8) 119 PrependUint8 prepends a uint8 to the Builder buffer. Aligns and checks 120 for space. 121 122 func (b *Builder) Reset() 123 Reset truncates the underlying Builder buffer, facilitating alloc-free 124 reuse of a Builder. It also resets bookkeeping data. 125 /// [Go API] 126