MCPcopy Create free account
hub / github.com/Monibuca/engine / writeString

Method writeString

util/amf3.go:110–127  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

108}
109
110func (amf *AMF3) writeString(s string) error {
111 index, ok := amf.scEnc[s]
112 if ok {
113 amf.writeU29(uint32(index << 1))
114 return nil
115 }
116
117 err := amf.writeU29(uint32((len(s) << 1) | 0x01))
118 if err != nil {
119 return err
120 }
121
122 if s != "" {
123 amf.scEnc[s] = len(amf.scEnc)
124 }
125 amf.WriteString(s)
126 return nil
127}
128
129func (amf *AMF3) readU29() (uint32, error) {
130 var ret uint32 = 0

Callers 1

MarshalMethod · 0.95

Calls 2

writeU29Method · 0.95
WriteStringMethod · 0.65

Tested by

no test coverage detected