Qore FileLocationHandler Module Reference 2.3
Loading...
Searching...
No Matches
FileLocationHandler::FileLocationHandler Class Reference

The main class. More...

#include <FileLocationHandler.qc.dox.h>

Static Public Member Methods

static binary getBinaryFileFromLocation (string location)
 Returns binary data for the given file location. More...
 
static Qore::InputStream getBinaryStreamFromLocation (string location)
 Returns an input stream for file data at the given location. More...
 
static data getFileFromLocation (bool text, string location)
 Returns the file data from the given location. More...
 
static hash< FileHandlerInfogetHandlerInfo (string scheme)
 Returns info about the location handler for he given scheme. More...
 
static list< string > getHandlerNames ()
 Returns a list of all handler names. More...
 
static hash< string, hash< FileHandlerInfo > > getHandlers (*bool write)
 Returns info about all cached handlers. More...
 
static Qore::AbstractPollOperation getIoPollerForLocation (string location)
 Returns a non-blocking I/O poller object to retrieve a binary file from the given location. More...
 
static OutputStreamWrapper getOutputStreamForLocation (string location)
 Returns an output stream for writing data to the given location. More...
 
static Qore::StreamReader getStreamReaderFromLocation (string location)
 Returns a string stream for the file's data at the given location. More...
 
static list< string > getSupportedSchemes ()
 Retuns a list of supported schemes. More...
 
static string getTextFileFromLocation (string location)
 Returns string data for the given file location. More...
 
static init ()
 Initializes default handlers.
 
static bool isSchemeSupported (string scheme)
 Returns True if the scheme is supported. More...
 
static registerHandler (string scheme, AbstractFileLocationHandler handler)
 Register a new location handler. More...
 
static bool tryRegisterHandler (string scheme, AbstractFileLocationHandler handler)
 Tries to register a new location handler; if the scheme is already registered, the method returns False. More...
 
static writeFileToLocation (string location, data contents)
 Writes data to a file at the given location. More...
 

Static Private Member Methods

static checkDynamicInit ()
 Checks for dynamic initialization.
 
static hash< InternallLocationInfo > getInfo (string location, bool read)
 Returns info about the requested location. More...
 
static *hash< auto > getOptions (reference< string > location)
 Returns a hash of options from the location string.
 
static Mutex handler_lock ()
 The location handler lock to ensure atomic operations.
 

Static Private Attributes

static hash< string, AbstractFileLocationHandlercache
 The location handler cache; scheme -> handler;.
 
static bool dynamic_init
 Flag for dynamic initialization.
 

Detailed Description

The main class.

Member Function Documentation

◆ getBinaryFileFromLocation()

static binary FileLocationHandler::FileLocationHandler::getBinaryFileFromLocation ( string  location)
static

Returns binary data for the given file location.

Parameters
locationthe location of the file data
Returns
the resource data as a binary value
Exceptions
LOCATION-ERRORthe location string cannotbe parsed; unknown location scheme; invalid location option

◆ getBinaryStreamFromLocation()

static Qore::InputStream FileLocationHandler::FileLocationHandler::getBinaryStreamFromLocation ( string  location)
static

Returns an input stream for file data at the given location.

Parameters
locationthe location of the file data
Returns
an input stream for the file's data

◆ getFileFromLocation()

static data FileLocationHandler::FileLocationHandler::getFileFromLocation ( bool  text,
string  location 
)
static

Returns the file data from the given location.

Parameters
texta flag if the data should be returned as text or not
locationthe location string
Exceptions
LOCATION-ERRORinvalid location or empty location string

◆ getHandlerInfo()

static hash< FileHandlerInfo > FileLocationHandler::FileLocationHandler::getHandlerInfo ( string  scheme)
static

Returns info about the location handler for he given scheme.

Parameters
schemethe scheme to provide info for
Exceptions
SCHEME-ERRORunsupported or invalid scheme
Since
v2.2.1

◆ getHandlerNames()

static list< string > FileLocationHandler::FileLocationHandler::getHandlerNames ( )
static

Returns a list of all handler names.

Returns
a list of all handler names
Since
v2.2.1

◆ getHandlers()

static hash< string, hash< FileHandlerInfo > > FileLocationHandler::FileLocationHandler::getHandlers ( *bool  write)
static

Returns info about all cached handlers.

Parameters
writeif information for write handler options should be returned (default: return read handler options)
Returns
a hash keyed by scheme with handler information for each scheme
Since
v2.2.1

◆ getInfo()

static hash< InternallLocationInfo > FileLocationHandler::FileLocationHandler::getInfo ( string  location,
bool  read 
)
staticprivate

Returns info about the requested location.

Parameters
locationthe location string
readif the location is meant for reading
Exceptions
LOCATION-ERRORunsupported or invalid location

◆ getIoPollerForLocation()

static Qore::AbstractPollOperation FileLocationHandler::FileLocationHandler::getIoPollerForLocation ( string  location)
static

Returns a non-blocking I/O poller object to retrieve a binary file from the given location.

Parameters
locationthe location string
Exceptions
LOCATION-ERRORinvalid location or empty location string

◆ getOutputStreamForLocation()

static OutputStreamWrapper FileLocationHandler::FileLocationHandler::getOutputStreamForLocation ( string  location)
static

Returns an output stream for writing data to the given location.

Parameters
locationthe location of the file data
Returns
an output stream for writing to the file getHandlerNames

◆ getStreamReaderFromLocation()

static Qore::StreamReader FileLocationHandler::FileLocationHandler::getStreamReaderFromLocation ( string  location)
static

Returns a string stream for the file's data at the given location.

Parameters
locationthe location of the file data
Returns
a stream reader for the file's data

◆ getSupportedSchemes()

static list< string > FileLocationHandler::FileLocationHandler::getSupportedSchemes ( )
static

Retuns a list of supported schemes.

Returns
a list of supported schemes

◆ getTextFileFromLocation()

static string FileLocationHandler::FileLocationHandler::getTextFileFromLocation ( string  location)
static

Returns string data for the given file location.

Parameters
locationthe location of the file data
Returns
the resource data as a string
Exceptions
LOCATION-ERRORthe location string cannotbe parsed; unknown location scheme; invalid location option

◆ isSchemeSupported()

static bool FileLocationHandler::FileLocationHandler::isSchemeSupported ( string  scheme)
static

Returns True if the scheme is supported.

Parameters
schemethe scheme to check
Returns
True if the scheme is supported

◆ registerHandler()

static FileLocationHandler::FileLocationHandler::registerHandler ( string  scheme,
AbstractFileLocationHandler  handler 
)
static

Register a new location handler.

Parameters
schemethe scheme for the location
handlerthe handler for the location, must have the signature:
data sub (string scheme, bool text, string location) {}
Exceptions
LOCATION-HANDLER-ERRORthe given location handler scheme has already been registered

◆ tryRegisterHandler()

static bool FileLocationHandler::FileLocationHandler::tryRegisterHandler ( string  scheme,
AbstractFileLocationHandler  handler 
)
static

Tries to register a new location handler; if the scheme is already registered, the method returns False.

Parameters
schemethe scheme for the location
handlerthe handler for the location, must have the signature:
Returns
True if the handler was registered, False if not (scheme already has a handler)
data sub (string scheme, bool text, string location) {}

◆ writeFileToLocation()

static FileLocationHandler::FileLocationHandler::writeFileToLocation ( string  location,
data  contents 
)
static

Writes data to a file at the given location.

Parameters
locationthe location of the file data
contentsthe file contents to write to the location