12#ifndef JAU_IO_BYTE_STREAM_HPP_
13#define JAU_IO_BYTE_STREAM_HPP_
29 using namespace jau::enums;
154 explicit operator bool() const noexcept {
return !
fail(); }
230 virtual bool isOpen() const noexcept = 0;
241 virtual
std::
string id() const noexcept {
return ""; }
336 [[nodiscard]] virtual
bool seekMark() noexcept = 0;
388 [[nodiscard]] virtual
size_t read(
void* out,
size_t length) noexcept = 0;
395 [[nodiscard]]
bool read(uint8_t& bits) noexcept {
396 return 1 !=
read(&bits, 1);
411 [[nodiscard]]
virtual size_t peek(
void* out,
size_t length,
size_type peek_offset)
noexcept = 0;
421 [[nodiscard]]
bool peek(uint8_t& out)
noexcept {
422 return 1 ==
peek(&out, 1, 0);
433 [[nodiscard]]
virtual size_t discard(
size_t N)
noexcept = 0;
442 [[nodiscard]]
bool readU16(uint16_t& bits)
noexcept {
443 if ( 2 !=
read(&bits, 2) ) {
458 [[nodiscard]]
bool readS16(int16_t& bits)
noexcept {
return readU16( *
reinterpret_cast<uint16_t*
>(&bits) ); }
467 [[nodiscard]]
bool readU32(uint32_t& bits)
noexcept {
468 if ( 4 !=
read(&bits, 4) ) {
483 [[nodiscard]]
bool readS32(int32_t& bits)
noexcept {
return readU32( *
reinterpret_cast<uint32_t*
>(&bits) ); }
491 if ( 4 !=
read(&bits, 8) ) {
503 [[nodiscard]]
bool readU64(uint64_t &bits)
noexcept {
504 if ( 4 !=
read(&bits, 8) ) {
520 [[nodiscard]]
bool readS64(int64_t &bits)
noexcept {
return readU64(*
reinterpret_cast<uint64_t *
>(&bits)); }
538 [[nodiscard]]
virtual size_t write(
const void* in,
size_t length)
noexcept = 0;
548 [[nodiscard]]
bool write(uint8_t in)
noexcept {
549 return 1 ==
write(&in, 1);
565 [[nodiscard]]
bool writeU16(uint16_t bits) noexcept {
569 return 2 ==
write(&bits, 2);
579 [[nodiscard]]
bool writeS16(int16_t bits)
noexcept {
return writeU16(*
reinterpret_cast<uint16_t*
>(&bits)); }
589 [[nodiscard]]
bool writeU32(uint32_t bits)
noexcept {
593 return 4 ==
write(&bits, 4);
603 [[nodiscard]]
bool writeS32(int32_t bits)
noexcept {
return writeU32(*
reinterpret_cast<uint32_t*
>(&bits)); }
612 return 8 ==
write(&bits, 8);
622 [[nodiscard]]
bool writeU64(uint64_t bits)
noexcept {
626 return 8 ==
write(&bits, 8);
636 [[nodiscard]]
bool writeS64(int64_t bits)
noexcept {
return writeU64(*
reinterpret_cast<uint64_t*
>(&bits)); }
697 bool isOpen() const noexcept
override {
return true; }
699 void close() noexcept override;
707 bool canRewind() const noexcept
override {
return true; }
711 std::string
toString() const noexcept override;
716 [[nodiscard]]
bool seekMark() noexcept override;
718 bool available(
size_t n) noexcept override;
719 [[nodiscard]]
size_t read(
void*,
size_t) noexcept override;
720 [[nodiscard]]
size_t peek(
void*,
size_t,
size_type) noexcept override;
721 [[nodiscard]]
size_t discard(
size_t N) noexcept override;
723 [[nodiscard]]
size_t write(const
void*,
size_t) noexcept override;
747 bool m_has_content_length;
751 size_type get_available()
const noexcept {
return m_has_content_length ? m_content_size - m_offset : 0; }
821 int fd() const noexcept {
return m_fd; }
823 bool isOpen() const noexcept
override {
return 0 <= m_fd; }
824 void close() noexcept override;
825 std::
string id() const noexcept
override {
return m_stats.path(); }
830 bool canRewind() const noexcept
override {
return true; }
832 std::string
toString() const noexcept override;
837 [[nodiscard]]
bool seekMark() noexcept override;
839 bool available(
size_t n) noexcept override;
840 [[nodiscard]]
size_t read(
void*,
size_t) noexcept override;
841 [[nodiscard]]
size_t peek(
void*,
size_t,
size_type) noexcept override;
842 [[nodiscard]]
size_t discard(
size_t N) noexcept override;
844 [[nodiscard]]
size_t write(const
void*,
size_t) noexcept override;
845 void flush() noexcept override;
868 std::vector<uint8_t> m_buffer;
885 return "Rew[end " + std::to_string(
end()) +
", capacity " + std::to_string(
capacity()) +
"]";
892 if ( readLimit > std::numeric_limits<size_t>::max() ) {
897 const size_t q = o - m;
898 const size_t l0 = m_end - q;
900 std::memmove(m_buffer.data(), m_buffer.data() + q, l0);
907 if ( readLimit > m_buffer.size() ) {
908 m_buffer.resize(readLimit, 0);
913 [[maybe_unused]]
size_t l0 = length;
914 size_t g1 = 0, g2 = 0;
916 const size_t p0 = o - m;
917 g1 = std::min(m + m_end - o, l0);
918 std::memcpy(out, m_buffer.data() + p0, g1);
923 g2 = newData((
char*)out + g1, l0);
925 if ( m_end + g2 > m_buffer.size() ) {
929 std::memcpy(m_buffer.data() + m_end, (
const char*)out + g1, g2);
967 iostate_t rdstate() const noexcept override;
969 bool isOpen() const noexcept override;
970 void close() noexcept override;
971 std::
string id() const noexcept
override {
return m_url; }
973 bool hasContentSize() const noexcept override;
977 bool canRewind() const noexcept
override {
return false; }
980 [[nodiscard]] size_type seek(size_type newPos)
noexcept override;
982 std::string
toString() const noexcept override;
984 [[nodiscard]]
bool setMark(size_type readLimit) noexcept override;
987 [[nodiscard]]
bool seekMark() noexcept override;
1002 bool available(
size_t n) noexcept override;
1019 [[nodiscard]]
size_t read(
void* out,
size_t length) noexcept override;
1021 [[nodiscard]]
size_t peek(
void* out,
size_t length, size_type peek_offset) noexcept override;
1024 [[nodiscard]]
size_t discard(
size_t N) noexcept override;
1026 [[nodiscard]]
size_t write(const
void*,
size_t) noexcept
override {
return 0; }
1030 size_type get_available() const noexcept {
return m_stream_resp->has_content_length ? m_stream_resp->content_length - m_offset : 0; }
1031 std::string to_string_int() const noexcept;
1033 const
std::
string m_url;
1035 ByteRingbuffer m_buffer;
1036 jau::
io::AsyncStreamResponseRef m_stream_resp;
1040 impl::RewindBuffer m_rewindbuf;
1042 impl::RewindBuffer::DataProvider newData = [&](
void* out,
size_t length) ->
size_t {
1043 bool timeout_occured =
false;
1044 const size_t g = m_buffer.getBlocking(
static_cast<uint8_t*
>(out), length, 1, m_timeout, timeout_occured);
1045 if ( timeout_occured ) {
1046 addstate_impl(iostate_t::timeout);
1047 if ( m_stream_resp->processing() ) {
1048 m_stream_resp->result = io_result_t::FAILED;
1050 m_buffer.interruptWriter();
1099 m_buffer.interruptReader();
1107 m_content_size = size;
1108 m_has_content_length =
true;
1122 iostate_t rdstate() const noexcept override;
1124 bool isOpen() const noexcept override;
1126 void close() noexcept override;
1128 std::
string id() const noexcept
override {
return m_id; }
1139 [[nodiscard]] size_type seek(size_type newPos)
noexcept override;
1141 std::string
toString() const noexcept override;
1143 [[nodiscard]]
bool setMark(size_type readLimit) noexcept override;
1146 [[nodiscard]]
bool seekMark() noexcept override;
1161 bool available(
size_t n) noexcept override;
1178 [[nodiscard]]
size_t read(
void* out,
size_t length) noexcept override;
1181 [[nodiscard]]
size_t peek(
void* out,
size_t length, size_type peek_offset) noexcept override;
1184 [[nodiscard]]
size_t discard(
size_t N) noexcept override;
1212 [[nodiscard]]
size_t write(const
void* in,
size_t length) noexcept
override {
1213 return write(in, length, m_timeout);
1219 size_type getAvailable() const noexcept {
return m_has_content_length ? m_content_size - m_offset : 0; }
1220 std::string toStringInt() const noexcept;
1222 const
std::
string m_id;
1224 ByteRingbuffer m_buffer;
1228 relaxed_atomic_io_result_t m_result;
1232 impl::RewindBuffer m_rewindbuf;
1234 impl::RewindBuffer::DataProvider newData = [&](
void* out,
size_t length) ->
size_t {
1235 bool timeout_occured =
false;
1237 const size_t g = m_buffer.getBlocking(
static_cast<uint8_t*
>(out), length, 1, m_timeout, timeout_occured);
1238 if ( timeout_occured ) {
1239 addstate_impl(iostate_t::timeout);
1240 if ( io_result_t::NONE == m_result ) {
1241 m_result = io_result_t::FAILED;
1243 m_buffer.interruptWriter();
1265 :
ByteStream(parent.mode(),
byteOrder), m_parent(parent), m_offset(0), m_buffer(buffer), m_rec_offset(0), m_is_recording(
false) { };
1279 void startRecording() noexcept;
1287 void stopRecording() noexcept;
1295 void clearRecording() noexcept;
1310 bool isOpen() const noexcept
override {
return m_parent.isOpen(); }
1312 void close() noexcept override;
1320 std::string
toString() const noexcept override;
1322 std::
string id() const noexcept
override {
return m_parent.id(); }
1324 bool canRewind() const noexcept
override {
return m_parent.canRewind(); }
1327 m_offset = m_parent.seek(newPos);
1330 [[nodiscard]]
size_t discard(
size_t N)
noexcept override {
1331 size_t n = m_parent.discard(N);
1332 m_offset = m_parent.position();
1336 [[nodiscard]]
bool setMark(
size_type readLimit)
noexcept override {
return m_parent.setMark(readLimit); }
1340 if ( m_parent.seekMark() ) {
1341 m_offset = m_parent.position();
1348 [[nodiscard]]
size_t read(
void*,
size_t)
noexcept override;
1350 [[nodiscard]]
size_t peek(
void* out,
size_t length,
size_type peek_offset)
noexcept override {
1351 return m_parent.peek(out, length, peek_offset);
1354 bool available(
size_t n)
noexcept override {
return m_parent.available(n); }
1356 [[nodiscard]]
size_t write(
const void*,
size_t)
noexcept override;
1357 void flush() noexcept
override { m_parent.flush(); }
1363 size_type m_rec_offset;
1364 bool m_is_recording;
Class template jau::function is a general-purpose static-polymorphic function wrapper.
~ByteInStream_Feed() noexcept override
ByteInStream_Feed & operator=(const ByteInStream_Feed &)=delete
bool canRewind() const noexcept override
Return true if implementation supports random rewinding the stream, i.e.
void interruptReader() noexcept
Interrupt a potentially blocked reader.
void setContentSize(const size_type size) noexcept
Set known content size, informal only.
ByteInStream_Feed(std::string id_name, const jau::fraction_i64 &timeout, lb_endian_t byteOrder=lb_endian_t::little) noexcept
Construct a ringbuffer backed externally provisioned byte input stream.
size_type position() const noexcept override
Returns the position indicator, similar to e.g.
size_type contentSize() const noexcept override
Returns the content_size if known.
void close() noexcept override
Close the stream if supported by the underlying mechanism.
void flush() noexcept override
Synchronizes all output operations, or do nothing.
ByteInStream_Feed(const ByteInStream_Feed &)=delete
size_t write(const void *in, size_t length, const jau::fraction_i64 &timeout) noexcept
Write given bytes to the async ringbuffer using explicit given timeout.
bool hasContentSize() const noexcept override
Returns true if implementation is aware of content_size(), otherwise false.
size_type markReadLimit() const noexcept override
Returns the readLimit set via setMark().
size_type mark() const noexcept override
Returns the markpos set via setMark() or ByteStream::npos if unset.
ByteInStream_URL(const ByteInStream_URL &)=delete
void flush() noexcept override
Synchronizes all output operations, or do nothing.
size_type markReadLimit() const noexcept override
Returns the readLimit set via setMark().
ByteInStream_URL(std::string url, const jau::fraction_i64 &timeout, lb_endian_t byteOrder=lb_endian_t::little) noexcept
Construct a ringbuffer backed Http byte input stream.
ByteInStream_URL & operator=(const ByteInStream_URL &)=delete
~ByteInStream_URL() noexcept override
size_type position() const noexcept override
Returns the position indicator, similar to e.g.
size_t write(const void *, size_t) noexcept override
Write to the data sink.
void close() noexcept override
Close the stream if supported by the underlying mechanism.
size_type mark() const noexcept override
Returns the markpos set via setMark() or ByteStream::npos if unset.
bool canRewind() const noexcept override
Return true if implementation supports random rewinding the stream, i.e.
size_type contentSize() const noexcept override
Returns the content_size if known.
size_type seek(size_type newPos) noexcept override
Sets position indicator for output-streams or input-streams with known length, similar to e....
size_type mark() const noexcept override
Returns the markpos set via setMark() or ByteStream::npos if unset.
size_t peek(void *, size_t, size_type) noexcept override
Read from the source but do not modify the internal offset.
bool setMark(size_type readLimit) noexcept override
Set markpos to current position, allowing the stream to be seekMark().
size_t discard(size_t N) noexcept override
Discard the next N bytes of the data.
size_type position() const noexcept override
Returns the position indicator, similar to e.g.
bool hasContentSize() const noexcept override
Returns true if implementation is aware of content_size(), otherwise false.
size_type contentSize() const noexcept override
Returns the content_size if known.
bool canRewind() const noexcept override
Return true if implementation supports random rewinding the stream, i.e.
~ByteStream_File() noexcept override
void close() noexcept override
Close the stream if supported by the underlying mechanism.
void flush() noexcept override
Synchronizes all output operations, or do nothing.
ByteStream_File(const ByteStream_File &)=delete
ByteStream_File & operator=(const ByteStream_File &)=delete
bool isOpen() const noexcept override
Checks if the stream has an associated file.
int fd() const noexcept
Returns the file descriptor if is_open(), otherwise -1 for no file descriptor.
size_type markReadLimit() const noexcept override
Returns the readLimit set via setMark().
std::string toString() const noexcept override
ByteStream_File(const std::string &path, iomode_t iomode=iomode_t::rw, const jau::io::fs::fmode_t fmode=fs::fmode_t::def_file_prot, lb_endian_t byteOrder=lb_endian_t::little) noexcept
Construct a stream based byte stream from filesystem path, either an existing or new file.
bool available(size_t n) noexcept override
Return whether n bytes are available in the input stream, if has_content_size() or using an asynchron...
const jau::io::fs::file_stats & stats() const noexcept
bool seekMark() noexcept override
Seeks stream position to markpos as set via setMark().
ByteStream_Recorder(ByteStream &parent, io::secure_vector< uint8_t > &buffer, lb_endian_t byteOrder=lb_endian_t::little) noexcept
Construct a byte input stream wrapper using the given parent ByteInStream.
bool hasContentSize() const noexcept override
Returns true if implementation is aware of content_size(), otherwise false.
size_type get_recording_start_pos() noexcept
Returns the recording start position.
size_t getRecordedBytes() noexcept
size_t discard(size_t N) noexcept override
Discard the next N bytes of the data.
bool available(size_t n) noexcept override
Return whether n bytes are available in the input stream, if has_content_size() or using an asynchron...
bool isOpen() const noexcept override
Checks if the stream has an associated file.
void close() noexcept override
Close the stream if supported by the underlying mechanism.
io::secure_vector< uint8_t > & get_recording() noexcept
Returns the reference of the recording buffer given by user.
size_type mark() const noexcept override
Returns the markpos set via setMark() or ByteStream::npos if unset.
void flush() noexcept override
Synchronizes all output operations, or do nothing.
bool canRewind() const noexcept override
Return true if implementation supports random rewinding the stream, i.e.
size_type contentSize() const noexcept override
Returns the content_size if known.
bool isRecording() noexcept
size_t peek(void *out, size_t length, size_type peek_offset) noexcept override
Read from the source but do not modify the internal offset.
ByteStream_Recorder & operator=(const ByteStream_Recorder &)=delete
bool seekMark() noexcept override
Seeks stream position to markpos as set via setMark().
~ByteStream_Recorder() noexcept override
size_type seek(size_type newPos) noexcept override
Sets position indicator for output-streams or input-streams with known length, similar to e....
ByteStream_Recorder(const ByteStream_Recorder &)=delete
size_type position() const noexcept override
Returns the position indicator, similar to e.g.
iostate_t rdstate() const noexcept override
Returns the current state flags.
void assignState(const iostate_t state=iostate_t::goodbit) noexcept override
Assigns given state to current value.
bool setMark(size_type readLimit) noexcept override
Set markpos to current position, allowing the stream to be seekMark().
size_type markReadLimit() const noexcept override
Returns the readLimit set via setMark().
bool canRewind() const noexcept override
Return true if implementation supports random rewinding the stream, i.e.
void close() noexcept override
Close the stream if supported by the underlying mechanism.
std::string toString() const noexcept override
size_type position() const noexcept override
Returns the position indicator, similar to e.g.
bool hasContentSize() const noexcept override
Returns true if implementation is aware of content_size(), otherwise false.
ByteStream_SecMemory(size_t length, iomode_t mode, lb_endian_t byteOrder=lb_endian_t::little)
Construct a secure memory source using a sized byte array.
~ByteStream_SecMemory() noexcept override
size_t discard(size_t N) noexcept override
Discard the next N bytes of the data.
size_t peek(void *, size_t, size_type) noexcept override
Read from the source but do not modify the internal offset.
ByteStream_SecMemory(io::secure_vector< uint8_t > &&in, iomode_t mode, lb_endian_t byteOrder=lb_endian_t::little)
Construct a secure memory source copying data from a secure_vector.
size_type contentSize() const noexcept override
Returns the content_size if known.
bool setMark(size_type readLimit) noexcept override
Set markpos to current position, allowing the stream to be seekMark().
bool isOpen() const noexcept override
Checks if the stream has an associated file.
size_type seek(size_type newPos) noexcept override
Sets position indicator for output-streams or input-streams with known length, similar to e....
void flush() noexcept override
Synchronizes all output operations, or do nothing.
ByteStream_SecMemory(const uint8_t in[], size_t length, iomode_t mode, lb_endian_t byteOrder=lb_endian_t::little)
Construct a secure memory source copying data from a byte array.
bool seekMark() noexcept override
Seeks stream position to markpos as set via setMark().
size_type mark() const noexcept override
Returns the markpos set via setMark() or ByteStream::npos if unset.
bool available(size_t n) noexcept override
Return whether n bytes are available in the input stream, if has_content_size() or using an asynchron...
size_type markReadLimit() const noexcept override
Returns the readLimit set via setMark().
ByteStream_SecMemory(const std::vector< uint8_t > &in, iomode_t mode, lb_endian_t byteOrder=lb_endian_t::little)
Construct a secure memory source copying data from a std::vector.
ByteStream_SecMemory(const std::string &in, lb_endian_t byteOrder=lb_endian_t::little)
Construct a secure memory source that reads from a string, iomode_t::read.
bool write(uint8_t in) noexcept
Write one byte, uint8_t.
bool readU64(uint64_t &bits) noexcept
Read incoming uint64_t.
bool writeS64(int64_t bits) noexcept
Write the given int64_t.
virtual void flush() noexcept=0
Synchronizes all output operations, or do nothing.
bool readS16(int16_t &bits) noexcept
Read int16_t.
virtual size_t read(void *out, size_t length) noexcept=0
Read from the source.
virtual bool isOpen() const noexcept=0
Checks if the stream has an associated file.
constexpr bool canWrite() const noexcept
Returns true in case stream has iomode::write capabilities.
virtual size_type mark() const noexcept=0
Returns the markpos set via setMark() or ByteStream::npos if unset.
bool writeS32(int32_t bits) noexcept
Write the given int32_t.
virtual bool seekMark() noexcept=0
Seeks stream position to markpos as set via setMark().
bool writeU32(uint32_t bits) noexcept
Write the given uint32_t.
constexpr bool canRead() const noexcept
Returns true in case stream has iomode::read capabilities.
virtual size_t write(const void *in, size_t length) noexcept=0
Write to the data sink.
virtual size_type markReadLimit() const noexcept=0
Returns the readLimit set via setMark().
size_t discardRead(size_t n) noexcept
Fallback slow discard implementation usind read() in case of unknown stream size.
bool readS32(int32_t &bits) noexcept
Read int32_t.
~ByteStream() noexcept override=default
virtual size_t discard(size_t N) noexcept=0
Discard the next N bytes of the data.
virtual bool setMark(size_type readLimit) noexcept=0
Set markpos to current position, allowing the stream to be seekMark().
bool writeU64(uint64_t bits) noexcept
Write the given uint64_t.
virtual std::string toString() const noexcept=0
bool writeS16(int16_t bits) noexcept
Write the given int16_t.
virtual bool hasContentSize() const noexcept=0
Returns true if implementation is aware of content_size(), otherwise false.
bool readS64(int64_t &bits) noexcept
Read int64_t.
void setImmutable() noexcept
Clears iomode_t::write from mode()
bool peek(uint8_t &out) noexcept
Peek one byte at current position.
virtual void close() noexcept=0
Close the stream if supported by the underlying mechanism.
virtual size_type contentSize() const noexcept=0
Returns the content_size if known.
bool readU32(uint32_t &bits) noexcept
Read incoming uint32_t.
constexpr lb_endian_t byteOrder() const noexcept
Returns endian byte-order of stream storage.
bool readU64Raw(uint64_t &bits) noexcept
Read incoming uint64_t w/o considering bigEndian, i.e.
virtual bool canRewind() const noexcept=0
Return true if implementation supports random rewinding the stream, i.e.
bool writeU16(uint16_t bits) noexcept
Write the given uint16_t.
uint64_t size_type
uint64_t size data type, bit position and count
bool readU16(uint16_t &bits) noexcept
Read uint16_t.
virtual bool available(size_t n) noexcept=0
Return whether n bytes are available in the input stream, if has_content_size() or using an asynchron...
virtual size_type position() const noexcept=0
Returns the position indicator, similar to e.g.
virtual size_t peek(void *out, size_t length, size_type peek_offset) noexcept=0
Read from the source but do not modify the internal offset.
ByteStream(iomode_t mode, lb_endian_t byteOrder=lb_endian_t::little) noexcept
virtual size_type remaining() const noexcept
Returns the remaining bytes, i.e.
virtual size_type seek(size_type newPos) noexcept=0
Sets position indicator for output-streams or input-streams with known length, similar to e....
constexpr iomode_t mode() const noexcept
bool writeU64Raw(uint64_t bits) noexcept
Write the given uint64_t w/o considering bigEndian, i.e.
static constexpr size_type npos
Invalid position constant, denoting unset mark() or invalid position.
void addState(const iostate_t state) noexcept
Adds given state flags to existing rdstate() bits.
virtual void assignState(const iostate_t state=iostate_t::goodbit) noexcept
Assigns given state to current value.
bool fail() const noexcept
Checks if an error has occurred.
virtual iostate_t rdstate() const noexcept
Returns the current state flags.
void clearStateFlags(const iostate_t clr) noexcept
Clears given state flags from current value.
bool operator!() const noexcept
Checks if an error has occurred, synonym of fail().
bool good() const noexcept
Checks if no error nor eof() has occurred i.e.
IOStateCap & operator=(IOStateCap &&o) noexcept=default
bool eof() const noexcept
Checks if end-of-file has been reached.
IOStateCap(const IOStateCap &o) noexcept=default
void setstate(const iostate_t state) noexcept
Sets state flags, by keeping its previous bits.
void clear(const iostate_t state=iostate_t::goodbit) noexcept
Clears state flags by assignment to the given value.
bool timeout() const noexcept
Checks if a timeout (non-recoverable) has occurred.
bool bad() const noexcept
Checks if a non-recoverable error has occurred.
constexpr iostate_t rdstate_impl() const noexcept
IOStateCap(IOStateCap &&o) noexcept=default
virtual ~IOStateCap() noexcept=default
constexpr void addstate_impl(iostate_t state) const noexcept
IOStateCap & operator=(const IOStateCap &o) noexcept=default
Platform agnostic representation of POSIX ::lstat() and ::stat() for a given pathname.
jau::function< size_t(void *out, size_t length)> DataProvider
jau::io::ByteStream::size_type size_type
bool setMark(const size_type m, size_type o, size_type readLimit) noexcept
constexpr size_type end() const noexcept
size_t read(size_type &m, size_type &o, DataProvider newData, void *out, const size_t length) noexcept
std::string toString() const noexcept
constexpr bool covered(const size_type m, size_type o) const noexcept
constexpr size_type capacity() const noexcept
constexpr uint16_t bswap(uint16_t const source) noexcept
lb_endian_t
Simplified reduced endian type only covering little- and big-endian.
@ native
Identifier for native platform type, one of the above.
@ little
Identifier for little endian, equivalent to endian::little.
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.
#define PRAGMA_DISABLE_WARNING_TYPE_RANGE_LIMIT
#define JAU_MAKE_BITFIELD_ENUM_STRING(type,...)
constexpr bool is_set(const E mask, const E bits) noexcept
std::ostream & operator<<(std::ostream &os, const T v)
#define PRAGMA_DISABLE_WARNING_PUSH
constexpr E & write(E &store, const E bits, bool set) noexcept
If set==true, sets the bits in store, i.e.
#define PRAGMA_DISABLE_WARNING_POP
fmode_t
Generic file type and POSIX protection mode bits as used in file_stats, touch(), mkdir() etc.
@ def_file_prot
Default file protection bit: Safe default: POSIX S_IRUSR | S_IWUSR | S_IRGRP or read_usr | write_usr ...
fraction< int64_t > fraction_i64
fraction using int64_t as integral type
iomode_t
Stream I/O mode, e.g.
io_result_t
I/O operation result value.
std::string toString(io_result_t v) noexcept
std::unique_ptr< ByteStream > to_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_supporte...
std::vector< T, jau::callocator_sec< T > > secure_vector
@ rw
Read and write capabilities, i.e.
@ writetrunc
Write capabilities and truncate existing (file) stream, i.e.
@ atend
Seek to end of (file) stream when opened.
@ trunc
Truncate existing (file) stream when opened with write.
@ write
Write capabilities.
@ goodbit
No error occurred nor has EOS being reached.
@ none
No error occurred nor has EOS being reached.
@ failbit
Input or output operation failed (formatting or extraction error).
@ eofbit
An input operation reached the end of its stream (EOS).
@ timeout
Input or output operation failed due to timeout.
@ badbit
Irrecoverable stream error, including loss of integrity of the underlying stream or media.
Author: Sven Gothel sgothel@jausoft.com Copyright (c) 2024 Gothel Software e.K.
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.