| Qore FileLocationHandler Module Reference 2.1

Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
FileLocationHandler::AbstractFileLocationHandler Class Referenceabstract

The abstract file location handler class. More...

Inheritance diagram for FileLocationHandler::AbstractFileLocationHandler:
[legend]

## Public Member Functions
binary | getBinaryFile (string scheme, string location, *hash< auto > opts)
| Retrieves a binary file from the given location. More...
Qore::InputStream | getBinaryStream (string scheme, string location, *hash< auto > opts)
| Retrieves a binary file from the given location. More...
OutputStreamWrapper | getOutputStream (string scheme, string location, *hash< auto > opts)
| Returns an output stream for writing data to the given location. More...
hash< string, hash< FileHandlerOptionInfo > > | getReadOptions ()
| Gets supported read options. More...
Qore::StreamReader | getStreamReader (string scheme, string location, *hash< auto > opts)
| Returns a string stream for the file's data at the given location. More...
string | getTextFile (string scheme, string location, *hash< auto > opts)
| Retrieves a text file from the given location. More...
hash< string, hash< FileHandlerOptionInfo > > | getWriteOptions ()
| Gets supported write options. More...
| writeFile (string scheme, string location, data contents, *hash< auto > opts)
| Writes data to a file at the given location. More...

## Protected Member Functions
abstract binary | getBinaryFileImpl (string scheme, string location, *hash< auto > opts)
| Retrieves a binary file from the given location. More...
abstract Qore::InputStream | getBinaryStreamImpl (string scheme, string location, *hash< auto > opts)
| Retrieves a binary file from the given location. More...
abstract OutputStreamWrapper | getOutputStreamImpl (string scheme, string location, *hash< auto > opts)
| Returns an output stream for writing data to the given location. More...
abstract hash< string, hash< FileHandlerOptionInfo > > | getReadOptionsImpl ()
| Gets supported read options. More...
abstract Qore::StreamReader | getStreamReaderImpl (string scheme, string location, *hash< auto > opts)
| Returns a string stream for the file's data at the given location. More...
abstract string | getTextFileImpl (string scheme, string location, *hash< auto > opts)
| Retrieves a text file from the given location. More...
abstract hash< string, hash< FileHandlerOptionInfo > > | getWriteOptionsImpl ()
| Gets supported write options. More...
abstract | writeFileImpl (string scheme, string location, data contents, *hash< auto > opts)
| Writes data to a file at the given location. More...

## Static Protected Member Functions
static string | forceEncoding (string str, *string encoding)
| Returns a string tagged with the given encoding, if any.

## Detailed Description

The abstract file location handler class.

## Member Function Documentation

## ◆ getBinaryFile()

binary FileLocationHandler::AbstractFileLocationHandler::getBinaryFile | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |

Retrieves a binary file from the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  the binary data of the file's contents, if it can be retrieved

## ◆ getBinaryFileImpl()

abstract binary FileLocationHandler::AbstractFileLocationHandler::getBinaryFileImpl | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |
| protected pure virtual

Retrieves a binary file from the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  the binary data of the file's contents, if it can be retrieved

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ getBinaryStream()

Qore::InputStream FileLocationHandler::AbstractFileLocationHandler::getBinaryStream | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |

Retrieves a binary file from the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  an input stream of the file's contents, if it can be retrieved

Note
  The data is read in the background and added to the input stream

## ◆ getBinaryStreamImpl()

abstract Qore::InputStream FileLocationHandler::AbstractFileLocationHandler::getBinaryStreamImpl | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |
| protected pure virtual

Retrieves a binary file from the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  an input stream of the file's contents, if it can be retrieved

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ getOutputStream()

OutputStreamWrapper FileLocationHandler::AbstractFileLocationHandler::getOutputStream | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |

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

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | write options

Returns
  an output stream for writing to the file

Note
  - OutputStreamWrapper::close() must be called to close the stream after writing terminates in order to avoid a deadlock
  - The data written to the OutputStreamWrapper object may be written in the background; to ensure that the data has been written to the target, call OutputStreamWrapper::waitForIo()

## ◆ getOutputStreamImpl()

abstract OutputStreamWrapper FileLocationHandler::AbstractFileLocationHandler::getOutputStreamImpl | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |
| protected pure virtual

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

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | write options

Returns
  an output stream for writing to the file

Note
  - OutputStreamWrapper::close() must be called to close the stream after writing terminates in order to avoid a deadlock
  - The data written to the OutputStreamWrapper object may be written in the background; to ensure that the data has been written to the target, call OutputStreamWrapper::waitForIo()

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ getReadOptions()

hash<string, hash<FileHandlerOptionInfo> > FileLocationHandler::AbstractFileLocationHandler::getReadOptions | ( |  | ) |

Gets supported read options.

Returns
  supported read options

## ◆ getReadOptionsImpl()

abstract hash<string, hash<FileHandlerOptionInfo> > FileLocationHandler::AbstractFileLocationHandler::getReadOptionsImpl | ( |  | ) |
| protected pure virtual

Gets supported read options.

Returns
  supported read options

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ getStreamReader()

Qore::StreamReader FileLocationHandler::AbstractFileLocationHandler::getStreamReader | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |

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

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  a stream reader for the file's contents, if it can be retrieved

Note
  The data is read in the background and added to the input stream backing the stream reader

## ◆ getStreamReaderImpl()

abstract Qore::StreamReader FileLocationHandler::AbstractFileLocationHandler::getStreamReaderImpl | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |
| protected pure virtual

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

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  a stream reader for the file's contents, if it can be retrieved

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ getTextFile()

string FileLocationHandler::AbstractFileLocationHandler::getTextFile | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |

Retrieves a text file from the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme or options
  opts | read options

Returns
  the string of the file's contents, if it can be retrieved

## ◆ getTextFileImpl()

abstract string FileLocationHandler::AbstractFileLocationHandler::getTextFileImpl | ( | string | scheme,
|  | string | location,
|  | *hash< auto > | opts
| ) |  |
| protected pure virtual

Retrieves a text file from the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  opts | read options

Returns
  the string of the file's contents, if it can be retrieved

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ getWriteOptions()

hash<string, hash<FileHandlerOptionInfo> > FileLocationHandler::AbstractFileLocationHandler::getWriteOptions | ( |  | ) |

Gets supported write options.

Returns
  supported write options

## ◆ getWriteOptionsImpl()

abstract hash<string, hash<FileHandlerOptionInfo> > FileLocationHandler::AbstractFileLocationHandler::getWriteOptionsImpl | ( |  | ) |
| protected pure virtual

Gets supported write options.

Returns
  supported write options

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.

## ◆ writeFile()

FileLocationHandler::AbstractFileLocationHandler::writeFile | ( | string | scheme,
|  | string | location,
|  | data | contents,
|  | *hash< auto > | opts
| ) |  |

Writes data to a file at the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  contents | the file's contents
  opts | write options

## ◆ writeFileImpl()

abstract FileLocationHandler::AbstractFileLocationHandler::writeFileImpl | ( | string | scheme,
|  | string | location,
|  | data | contents,
|  | *hash< auto > | opts
| ) |  |
| protected pure virtual

Writes data to a file at the given location.

Parameters

  scheme | the scheme being used
  location | the location string without the scheme
  contents | the file's contents
  opts | write options

Implemented in FileLocationHandler::FileLocationHandlerSftp, FileLocationHandler::FileLocationHandlerHttp, FileLocationHandler::FileLocationHandlerFtp, FileLocationHandler::FileLocationHandlerFile, and FileLocationHandler::FileLocationHandlerData.