Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Classes | Namespaces | Typedefs | Enumerations | Functions | Variables
io_util.hpp File Reference
#include <string>
#include <cstdint>
#include <thread>
#include <vector>
#include <jau/basic_types.hpp>
#include <jau/callocator_sec.hpp>
#include <jau/ringbuffer.hpp>
#include <jau/functional.hpp>
Include dependency graph for io_util.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  jau::io::url_header_sync
 Synchronization for URL header completion as used by asynchronous read_url_stream(). More...
 

Namespaces

namespace  jau
 __pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
 
namespace  jau::io
 
namespace  jau::io::uri_tk
 Limited URI toolkit to query handled protocols by the IO implementation.
 

Typedefs

typedef jau::ringbuffer< uint8_t, size_t > jau::io::ByteRingbuffer
 
typedef jau::ordered_atomic< async_io_result_t, std::memory_order_relaxed > jau::io::relaxed_atomic_async_io_result_t
 
typedef std::basic_string< char, std::char_traits< char >, jau::callocator_sec< char > > jau::io::secure_string
 
template<typename T >
using jau::io::secure_vector = std::vector< T, jau::callocator_sec< T > >
 
typedef jau::function< bool(secure_vector< uint8_t > &, bool)> jau::io::StreamConsumerFunc
 Stream consumer function. More...
 

Enumerations

enum class  jau::io::async_io_result_t : int8_t { jau::io::async_io_result_t::FAILED = -1 , jau::io::async_io_result_t::NONE = 0 , jau::io::async_io_result_t::SUCCESS = 1 }
 Asynchronous I/O operation result value. More...
 
enum class  jau::io::io_dir_t : int8_t { jau::io::io_dir_t::READ = 0 , jau::io::io_dir_t::WRITE = 1 }
 I/O direction, read or write. More...
 

Functions

std::string_view jau::io::uri_tk::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. More...
 
bool jau::io::uri_tk::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.e. More...
 
bool jau::io::uri_tk::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. More...
 
void jau::io::print_stats (const std::string &prefix, const uint64_t &out_bytes_total, const jau::fraction_i64 &td) noexcept
 
bool jau::io::uri_tk::protocol_supported (const std::string_view &uri) noexcept
 Returns true if the uri-scheme of given uri matches a supported by libcurl network protocols otherwise false. More...
 
uint64_t jau::io::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_fn. More...
 
uint64_t jau::io::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. More...
 
uint64_t jau::io::read_stream (ByteInStream &in, secure_vector< uint8_t > &buffer1, secure_vector< uint8_t > &buffer2, const StreamConsumerFunc &consumer_fn) noexcept
 Synchronous double-buffered byte input stream reader using the given StreamConsumerFunc consumer_fn. More...
 
std::unique_ptr< std::thread > jau::io::read_url_stream (const std::string &url, ByteRingbuffer &buffer, jau::io::url_header_sync &header_sync, jau::relaxed_atomic_bool &has_content_length, jau::relaxed_atomic_uint64 &content_length, jau::relaxed_atomic_uint64 &total_read, relaxed_atomic_async_io_result_t &result) noexcept
 Asynchronous URL read content using the given byte jau::ringbuffer, allowing parallel reading. More...
 
uint64_t jau::io::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. More...
 
std::vector< std::string_view > jau::io::uri_tk::supported_protocols () noexcept
 Returns a list of supported protocol supported by libcurl network protocols, queried at runtime. More...
 

Variables

const size_t jau::io::BEST_URLSTREAM_RINGBUFFER_SIZE = 2_uz * 16384_uz