MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ReadAllBytes

Method ReadAllBytes

Source/Engine/Platform/Base/FileBase.cpp:11–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include "Engine/Profiler/ProfilerCPU.h"
10
11bool FileBase::ReadAllBytes(const StringView& path, void* data, int32 length)
12{
13 PROFILE_CPU_NAMED("File::ReadAllBytes");
14 ZoneText(*path, path.Length());
15 bool result = true;
16 auto file = File::Open(path, FileMode::OpenExisting, FileAccess::Read, FileShare::All);
17 if (file)
18 {
19 const uint32 size = Math::Min<uint32>(file->GetSize(), length);
20 if (size > 0)
21 {
22 result = file->Read(data, size) != 0;
23 }
24 else
25 {
26 result = false;
27 }
28 Delete(file);
29 }
30 return result;
31}
32
33bool FileBase::ReadAllBytes(const StringView& path, Array<byte>& data)
34{

Callers 2

LoadAssemblyImageMethod · 0.80
SearchRefsMethod · 0.80

Calls 8

DeleteFunction · 0.85
LengthMethod · 0.45
GetSizeMethod · 0.45
ReadMethod · 0.45
ResizeMethod · 0.45
GetMethod · 0.45
AllocateMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected