| Qore FileLocationHandler Module Reference 2.1

FileLocationHandlerFile.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3
4 /* FileLocationHandlerFile Copyright 2021 - 2022 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24
26 namespace FileLocationHandler {
28 class FileLocationHandlerFile : public AbstractFileLocationHandler {
29
30 public:
32
34 const FileLocationOpts = {
35 "encoding": <FileHandlerOptionInfo>{
36 "type": "string",
37 "desc": "the encoding of the file's data (read / write)",
38 },
39 "max_file_len": <FileHandlerOptionInfo>{
40 "type": "int",
41 "default_value": -1,
42 "desc": "maximum length of files (read / write)",
43 },
44 };
45
47
49 const FileLocationReadOpts = FileLocationOpts + {
50 "stream_read_io_timeout": <FileHandlerOptionInfo>{
51 "type": "int",
52 "default_value": 60000,
53 "desc": "the default I/O timeout for stream operations, default is 60 seconds",
54 },
55 "stream_nonblock_open": <FileHandlerOptionInfo>{
56 "type": "bool",
57 "default_value": False,
58 "desc": "if True then the stream will be opened in nonblocking mode (default False)",
59 },
60 };
61
63
65 const FileLocationWriteOpts = FileLocationOpts + {
66 "append": <FileHandlerOptionInfo>{
67 "type": "bool",
68 "default_value": False,
69 "desc": "if true the file will be appended, otherwise it will be truncated (the default)",
70 },
71 "file_permissions": <FileHandlerOptionInfo>{
72 "type": "int",
73 "default_value": 0644,
74 "desc": "file permissions (default: 0664)",
75 },
76 };
77
79
89 protected:
90 string getTextFileImpl(string scheme, string location, *hash<auto> opts);
91 public:
92
93
95
105 protected:
106 binary getBinaryFileImpl(string scheme, string location, *hash<auto> opts);
107 public:
108
109
111
119 protected:
120 Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash<auto> opts);
121 public:
122
123
125
133 protected:
134 Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash<auto> opts);
135 public:
136
137
139
146 protected:
147 writeFileImpl(string scheme, string location, data contents, *hash<auto> opts);
148 public:
149
150
152
163 protected:
164 OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash<auto> opts);
165 public:
166
167
169
171 protected:
172 hash<string, hash<FileHandlerOptionInfo>> getReadOptionsImpl();
173 public:
174
175
177
179 protected:
180 hash<string, hash<FileHandlerOptionInfo>> getWriteOptionsImpl();
181 public:
182
183 };
184 };
FileLocationHandler::AbstractFileLocationHandler
The abstract file location handler class.
Definition: FileLocationHandler.qc.dox.h:43
FileLocationHandler::FileLocationHandlerFile
The class for handling "file://" locations.
Definition: FileLocationHandlerFile.qc.dox.h:28
FileLocationHandler::FileLocationHandlerFile::FileLocationWriteOpts
const FileLocationWriteOpts
Valid file location write options.
Definition: FileLocationHandlerFile.qc.dox.h:65
FileLocationHandler::FileLocationHandlerFile::FileLocationReadOpts
const FileLocationReadOpts
Valid common file location options.
Definition: FileLocationHandlerFile.qc.dox.h:49
FileLocationHandler::FileLocationHandlerFile::getStreamReaderImpl
Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash< auto > opts)
Returns a stream reader for the file's data at the given location.
FileLocationHandler::FileLocationHandlerFile::getBinaryFileImpl
binary getBinaryFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
FileLocationHandler::FileLocationHandlerFile::getReadOptionsImpl
hash< string, hash< FileHandlerOptionInfo > > getReadOptionsImpl()
Gets supported read options.
FileLocationHandler::FileLocationHandlerFile::FileLocationOpts
const FileLocationOpts
Valid common file location options.
Definition: FileLocationHandlerFile.qc.dox.h:34
FileLocationHandler::FileLocationHandlerFile::getTextFileImpl
string getTextFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a text file from the given location.
FileLocationHandler::FileLocationHandlerFile::getWriteOptionsImpl
hash< string, hash< FileHandlerOptionInfo > > getWriteOptionsImpl()
Gets supported write options.
FileLocationHandler::FileLocationHandlerFile::getBinaryStreamImpl
Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
FileLocationHandler::FileLocationHandlerFile::getOutputStreamImpl
OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash< auto > opts)
Returns an output stream for writing data to the given location.
FileLocationHandler::FileLocationHandlerFile::writeFileImpl
writeFileImpl(string scheme, string location, data contents, *hash< auto > opts)
Writes data to a file at the given location.
FileLocationHandler::OutputStreamWrapper
The abstract file location handler class.
Definition: OutputStramWrapper.qc.dox.h:28
Qore::InputStream
Qore::StreamReader
False
const False
binary
binary binary()
FileLocationHandler
Contains all public definitions in the FileLocationHandler module.
Definition: FileLocationHandler.qc.dox.h:26
FileLocationHandler::FileHandlerOptionInfo
File handler option info.
Definition: FileLocationHandler.qc.dox.h:28