jaulib v1.1.2-28-g30efb27-dirty
Jau Support Library (C++, Java, ..)
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
jau::io Namespace Reference

Namespaces

namespace  uri_tk
 Limited URI toolkit to query handled protocols by the IO implementation.
 

Classes

class  ByteInStream
 Abstract byte input stream object. More...
 
class  ByteInStream_Feed
 Ringbuffer-Based byte input stream with an externally provisioned data feed. More...
 
class  ByteInStream_File
 File based byte input stream, including named file descriptor. More...
 
class  ByteInStream_Recorder
 Wrapped byte input stream with the capability to record the read byte stream at will. More...
 
class  ByteInStream_SecMemory
 Secure Memory-Based byte input stream. More...
 
class  ByteInStream_URL
 Ringbuffer-Based byte input stream with a URL connection provisioned data feed. More...
 
class  ByteOutStream
 Abstract byte output stream object, to write data to a sink. More...
 
class  ByteOutStream_File
 File based byte output stream, including named file descriptor. More...
 
class  iostate_func
 Supporting std::basic_ios's iostate functionality for all ByteInStream implementations. More...
 
class  url_header_sync
 Synchronization for URL header completion as used by asynchronous read_url_stream(). More...
 

Typedefs

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

Enumerations

enum class  async_io_result_t : int8_t { async_io_result_t::FAILED = -1 , async_io_result_t::NONE = 0 , async_io_result_t::SUCCESS = 1 }
 Asynchronous I/O operation result value. More...
 
enum class  io_dir_t : int8_t { io_dir_t::READ = 0 , io_dir_t::WRITE = 1 }
 I/O direction, read or write. More...
 
enum class  iostate : uint32_t {
  iostate::none = 0 , iostate::goodbit = 0 , iostate::badbit = 1 << 0 , iostate::eofbit = 1 << 1 ,
  iostate::failbit = 1 << 2 , iostate::timeout = 1 << 3
}
 Mimic std::ios_base::iostate for state functionality, see iostate_func. More...
 

Functions

constexpr uint32_t number (const iostate rhs) noexcept
 
constexpr bool operator!= (const iostate lhs, const iostate rhs) noexcept
 
constexpr iostate operator& (const iostate lhs, const iostate rhs) noexcept
 
constexpr iostateoperator&= (iostate &lhs, const iostate rhs) noexcept
 
constexpr bool operator== (const iostate lhs, const iostate rhs) noexcept
 
constexpr iostate operator^ (const iostate lhs, const iostate rhs) noexcept
 
constexpr iostateoperator^= (iostate &lhs, const iostate rhs) noexcept
 
constexpr iostate operator| (const iostate lhs, const iostate rhs) noexcept
 
constexpr iostateoperator|= (iostate &lhs, const iostate rhs) noexcept
 
constexpr iostate operator~ (const iostate rhs) noexcept
 
void print_stats (const std::string &prefix, const uint64_t &out_bytes_total, const jau::fraction_i64 &td) noexcept
 
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_fn. More...
 
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. More...
 
uint64_t 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 > 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 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::unique_ptr< ByteInStreamto_ByteInStream (const std::string &path_or_uri, jau::fraction_i64 timeout=20_s) noexcept
 Parses the given path_or_uri, if it matches a supported protocol, see jau::io::uri::protocol_supported(), but is not a local file, see jau::io::uri::is_local_file_protocol(), ByteInStream_URL is being attempted. More...
 
std::string to_string (const iostate mask) noexcept
 

Variables

const size_t BEST_URLSTREAM_RINGBUFFER_SIZE = 2_uz * 16384_uz