MCPcopy
hub / github.com/EngoEngine/engo / LoadReaderData

Method LoadReaderData

assets.go:119–130  ·  view source on GitHub ↗

LoadReaderData loads a resource when you already have the reader for it.

(url string, f io.Reader)

Source from the content-addressed store, hash-verified

117
118// LoadReaderData loads a resource when you already have the reader for it.
119func (formats *Formats) LoadReaderData(url string, f io.Reader) error {
120 ext := getExt(url)
121 if loader, ok := Files.formats[ext]; ok {
122 // This specific loader needs to be given the root
123 rl, ok := loader.(FileLoaderRooter)
124 if ok {
125 rl.SetRoot(formats.GetRoot())
126 }
127 return loader.Load(url, f)
128 }
129 return fmt.Errorf("no `FileLoader` associated with this extension: %q in url %q", ext, url)
130}
131
132// Unload releases the given resource from memory.
133func (formats *Formats) Unload(url string) error {

Calls 4

GetRootMethod · 0.95
getExtFunction · 0.70
SetRootMethod · 0.65
LoadMethod · 0.65