A factory to create RandomAccess instances from various ressources.
More...
#include <iolink/storage/RandomAccessFactory.h>
A factory to create RandomAccess instances from various ressources.
◆ copyInMemory()
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::copyInMemory |
( |
std::shared_ptr< RandomAccess > |
randomAccess | ) |
|
|
static |
Load given RandomAccess in memory.
If storage is already an in-memory RandomAccess, return it (no copy are done).
- Exceptions
-
◆ extractRegion() [1/2]
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::extractRegion |
( |
std::shared_ptr< RandomAccess > |
src, |
|
|
size_t |
offset |
|
) |
| |
|
static |
Creates an accessor to a subset of a RandomAccess.
- Parameters
-
src | The accessor to create the subset from |
offset | The offset from the start of the source accessor |
- Exceptions
-
◆ extractRegion() [2/2]
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::extractRegion |
( |
std::shared_ptr< RandomAccess > |
src, |
|
|
size_t |
offset, |
|
|
size_t |
size |
|
) |
| |
|
static |
Creates an accessor to a subset of a RandomAccess.
- Parameters
-
src | The accessor to create the subset from |
offset | The offset from the start of the source accessor |
size | The size of the subset. |
- Exceptions
-
InvalidArgument | if input randomAccess is null |
Error | When the subset range is out of the source accessor range. |
◆ fromBuffer()
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::fromBuffer |
( |
void * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
static |
Create a RandomAccess from given memory area.
- Warning
- The return DataAccess does not have the ownership of given buffer. You must carefully manage lifetime of each objects.
◆ fromStream()
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::fromStream |
( |
std::shared_ptr< StreamAccess > |
stream | ) |
|
|
static |
◆ mapFile()
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::mapFile |
( |
const std::string & |
filePath | ) |
|
|
static |
Get an accessor from a file mapped in memory.
- Parameters
-
filePath | The path to the file to map. |
- Returns
- A RandomAccess with read and write capabilities.
- Exceptions
-
Error | If the file does not exist already |
◆ openHTTPRead()
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::openHTTPRead |
( |
const Uri & |
uri, |
|
|
const std::string & |
method, |
|
|
const HTTPHeaders & |
headers |
|
) |
| |
|
static |
Create a RandomAccess from given HTTP URI, opening URI in Read Only.
Requested HTTP server must support HTTP range requests.
- Parameters
-
uri | The HTTP(S) URI to get. |
method | The HTTP request method. |
headers | The HTTP request headers. |
◆ openURIRead()
static std::shared_ptr< RandomAccess > iolink::RandomAccessFactory::openURIRead |
( |
const Uri & |
uri | ) |
|
|
static |
The documentation for this class was generated from the following file: