26#ifndef JAU_IO_UTIL_HPP_
27#define JAU_IO_UTIL_HPP_
46 template<
typename T>
using secure_vector = std::vector<T, jau::callocator_sec<T>>;
101 uint64_t
read_file(
const std::string& input_file,
180 std::condition_variable m_cv;
273 std::string_view
get_scheme(
const std::string_view& uri)
noexcept;
Class template jau::function is a general-purpose static-polymorphic function wrapper.
Abstract byte input stream object.
Ring buffer implementation, a.k.a circular buffer, exposing lock-free get*(..) and put*(....
ordered_atomic< bool, std::memory_order_relaxed > relaxed_atomic_bool
Relaxed non-SC atomic integral scalar boolean.
ordered_atomic< uint64_t, std::memory_order_relaxed > relaxed_atomic_uint64
Relaxed non-SC atomic integral scalar uint64_t.
fraction< int64_t > fraction_i64
fraction using int64_t as integral type
bool is_local_file_protocol(const std::string_view &uri) noexcept
Returns true if the uri-scheme of given uri matches the local file protocol, i.e.
io_dir_t
I/O direction, read or write.
uint64_t read_stream(ByteInStream &in, secure_vector< uint8_t > &buffer, const StreamConsumerFunc &consumer_fn) noexcept
Synchronous byte input stream reader using the given StreamConsumerFunc consumer_fn.
uint64_t read_url_stream(const std::string &url, secure_vector< uint8_t > &buffer, const StreamConsumerFunc &consumer_fn) noexcept
Synchronous URL stream reader using the given StreamConsumerFunc consumer_fn.
jau::function< bool(secure_vector< uint8_t > &, bool)> StreamConsumerFunc
Stream consumer function.
bool is_httpx_protocol(const std::string_view &uri) noexcept
Returns true if the uri-scheme of given uri matches the http or https protocol, i....
std::string_view get_scheme(const std::string_view &uri) noexcept
Returns the valid uri-scheme from given uri, which is empty if no valid scheme is included.
std::vector< std::string_view > supported_protocols() noexcept
Returns a list of supported protocol supported by libcurl network protocols, queried at runtime.
async_io_result_t
Asynchronous I/O operation result value.
std::basic_string< char, std::char_traits< char >, jau::callocator_sec< char > > secure_string
jau::ringbuffer< uint8_t, size_t > ByteRingbuffer
const size_t BEST_URLSTREAM_RINGBUFFER_SIZE
std::vector< T, jau::callocator_sec< T > > secure_vector
void print_stats(const std::string &prefix, const uint64_t &out_bytes_total, const jau::fraction_i64 &td) noexcept
jau::ordered_atomic< async_io_result_t, std::memory_order_relaxed > relaxed_atomic_async_io_result_t
uint64_t read_file(const std::string &input_file, secure_vector< uint8_t > &buffer, const StreamConsumerFunc &consumer_fn) noexcept
Synchronous byte input stream reader from given file path using the given StreamConsumerFunc consumer...
bool protocol_supported(const std::string_view &uri) noexcept
Returns true if the uri-scheme of given uri matches a supported by libcurl network protocols otherwis...
@ timeout
Input or output operation failed due to timeout.
@ NONE
Operation still in progress.
@ FAILED
Operation failed.
@ SUCCESS
Operation succeeded.
Limited URI toolkit to query handled protocols by the IO implementation.
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
A simple secure allocator for integral types using POSIX C functions: ::malloc() and ::free().
std::atomic<T> type with predefined fixed std::memory_order, not allowing changing the memory model o...