MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / ReadStringMap

Method ReadStringMap

protocol/nbt/staticReader.go:200–225  ·  view source on GitHub ↗

super convenient

(tgt map[string]string)

Source from the content-addressed store, hash-verified

198
199// super convenient
200func (cr CompoundReader) ReadStringMap(tgt map[string]string) error {
201 for {
202 typeId, err := cr.r.readByte()
203 if err != nil {
204 return err
205 }
206 if typeId == End {
207 return nil
208 }
209 name, err := cr.r.readString()
210 if err != nil {
211 return err
212 }
213
214 switch typeId {
215 case String:
216 str, err := cr.r.readString()
217 if err != nil {
218 return err
219 }
220 tgt[name] = str
221 default:
222 return fmt.Errorf("unsupported tag %d for string map", typeId)
223 }
224 }
225}
226
227func (cr CompoundReader) ReadAll(targets ...any) error {
228 for i := 0; i < len(targets)+1; i++ { //+1 to read end

Callers 1

ReadAllMethod · 0.80

Calls 2

readByteMethod · 0.45
readStringMethod · 0.45

Tested by

no test coverage detected