Developer World
Spresense Arduino Library v3.2.0-77d75a4
StorageClass Class Reference

The Storage class provides functions for accessing the storage manipulating its files and directories.
More...

#include <Storage.h>

Inheritance diagram for StorageClass:

Public Member Functions

 StorageClass (const char *str)
 
File open (const char *filename, uint8_t mode=FILE_READ)
 Opens a file on the Flash. More...
 
File open (const String &filename, uint8_t mode=FILE_READ)
 Opens a file on the Flash. More...
 
boolean exists (const char *filepath)
 Tests whether a file or directory exists on the Flash. More...
 
boolean exists (const String &filepath)
 Tests whether a file or directory exists on the Flash. More...
 
boolean mkdir (const char *filepath)
 Create a directory on the Flash. More...
 
boolean mkdir (const String &filepath)
 Create a directory on the Flash. More...
 
boolean remove (const char *filepath)
 Remove a file from the Flash. More...
 
boolean remove (const String &filepath)
 Remove a file from the Flash. More...
 
boolean rmdir (const char *filepath)
 Remove a directory from the Flash. More...
 
boolean rmdir (const String &filepath)
 Remove a directory from the Flash. More...
 

Protected Attributes

char mountdir [16]
 

Detailed Description

The Storage class provides functions for accessing the storage manipulating its files and directories.

Member Function Documentation

◆ open() [1/2]

File StorageClass::open ( const char *  filename,
uint8_t  mode = FILE_READ 
)

Opens a file on the Flash.

If the file is opened for writing, it will be created if it doesn't already exist (but the directory containing it must already exist).

Parameters
[in]filenameThe name of the file to open.
[in]modeThe mode in which to open the file.
Returns
File object referring to the opened file.

◆ open() [2/2]

File StorageClass::open ( const String &  filename,
uint8_t  mode = FILE_READ 
)
inline

Opens a file on the Flash.

If the file is opened for writing, it will be created if it doesn't already exist (but the directory containing it must already exist).

Parameters
[in]filenameThe name of the file to open.
[in]modeThe mode in which to open the file.
Returns
File object referring to the opened file.

◆ exists() [1/2]

boolean StorageClass::exists ( const char *  filepath)

Tests whether a file or directory exists on the Flash.

Parameters
[in]filepathThe name of the file to test for existence.
Returns
true if the file or directory exists, false if not

◆ exists() [2/2]

boolean StorageClass::exists ( const String &  filepath)
inline

Tests whether a file or directory exists on the Flash.

Parameters
[in]filepathThe name of the file to test for existence.
Returns
true if the file or directory exists, false if not

◆ mkdir() [1/2]

boolean StorageClass::mkdir ( const char *  filepath)

Create a directory on the Flash.

This will also create any intermediate directories that don't already exists.

Parameters
[in]filepathThe name of the directory to create.
Returns
true if the creation of the directory succeeded, false if not

◆ mkdir() [2/2]

boolean StorageClass::mkdir ( const String &  filepath)
inline

Create a directory on the Flash.

This will also create any intermediate directories that don't already exists.

Parameters
[in]filepathThe name of the directory to create.
Returns
true if the creation of the directory succeeded, false if not

◆ remove() [1/2]

boolean StorageClass::remove ( const char *  filepath)

Remove a file from the Flash.

Parameters
[in]filepathThe name of the file to remove.
Returns
true if the removal of the file succeeded, false if not

◆ remove() [2/2]

boolean StorageClass::remove ( const String &  filepath)
inline

Remove a file from the Flash.

Parameters
[in]filepathThe name of the file to remove.
Returns
true if the removal of the file succeeded, false if not

◆ rmdir() [1/2]

boolean StorageClass::rmdir ( const char *  filepath)

Remove a directory from the Flash.

The directory must be empty.

Parameters
[in]filepathThe name of the directory to remove.
Returns
true if the removal of the directory succeeded, false if not

◆ rmdir() [2/2]

boolean StorageClass::rmdir ( const String &  filepath)
inline

Remove a directory from the Flash.

The directory must be empty.

Parameters
[in]filepathThe name of the directory to remove.
Returns
true if the removal of the directory succeeded, false if not

The documentation for this class was generated from the following file: