14 #if defined(SL_STORAGE_FS)
16 #elif defined(SL_STORAGE_WEB)
27 unsigned char*
copy =
new unsigned char[
size];
54 #if defined(SL_STORAGE_FS)
61 #elif defined(SL_STORAGE_WEB)
62 Utils::log(
"I/O",
"OPENING \"%s\", (%d)", path.c_str(), kind);
123 #if defined(SL_STORAGE_FS)
125 #elif defined(SL_STORAGE_WEB)
151 size_t size = stream->
size();
152 unsigned char* data =
new unsigned char[size];
153 stream->
read(data, size);
172 size_t size = stream->
size();
175 stream->
read((
void*)
string.data(), size);
193 const std::string&
string)
196 stream->
write(
string.c_str(),
string.size());
SLIOStreamMode
Enum of stream opening modes.
SLIOStreamKind
Enum of file kinds.
static WAI::ModeOrbSlam2 * mode
SLIOStream implementation for downloading files from a web server.
static bool exists(std::string url)
SLIOStream implementation for reading from browser local storage.
SLIOStream implementation for reading from native files.
Interface for accessing external data using streams.
virtual size_t write(const void *buffer, size_t size)
virtual size_t read(void *buffer, size_t size)
SLIOStream implementation for writing to browser local storage.
SLIOStream implementation for writing to native files.
void close(SLIOStream *stream)
Closes and deletes a stream.
SLIOBuffer readIntoBuffer(std::string path, SLIOStreamKind kind)
Reads an entire file into memory.
bool exists(std::string path, SLIOStreamKind kind)
Checks whether a given file exists.
SLIOStream * open(std::string path, SLIOStreamKind kind, SLIOStreamMode mode)
Opens a file stream for I/O operations.
std::string readIntoString(std::string path, SLIOStreamKind kind)
Reads an entire file into a string.
void writeString(std::string path, SLIOStreamKind kind, const std::string &string)
Writes a string to a file.
bool exists(std::string path)
bool fileExists(const string &pathfilename)
Returns true if a file exists.
void log(const char *tag, const char *format,...)
logs a formatted string platform independently
Utility struct that holds a pointer and its length.
SLIOBuffer copy()
Creates a copy of the data in the buffer.
void deallocate()
Deallocates the data owned by the buffer.