jaulib v1.3.6
Jau Support Library (C++, Java, ..)
|
Secure Memory-Based byte input stream. More...
#include <byte_stream.hpp>
Public Member Functions | |
ByteInStream_SecMemory (const std::string &in) | |
Construct a secure memory source that reads from a string. | |
ByteInStream_SecMemory (const std::vector< uint8_t > &in) | |
Construct a secure memory source that reads from a std::vector. | |
ByteInStream_SecMemory (const uint8_t in[], size_t length) | |
Construct a secure memory source that reads from a byte array. | |
ByteInStream_SecMemory (io::secure_vector< uint8_t > in) | |
Construct a secure memory source that reads from a secure_vector. | |
~ByteInStream_SecMemory () noexcept override | |
bool | available (size_t n) noexcept override |
Return whether n bytes are available in the input stream, if has_content_size() or using an asynchronous source. | |
void | close () noexcept override |
Close the stream if supported by the underlying mechanism. | |
uint64_t | content_size () const noexcept override |
Returns the content_size if known. | |
bool | has_content_size () const noexcept override |
Returns true if implementation is aware of content_size(), otherwise false. | |
bool | is_open () const noexcept override |
Checks if the stream has an associated file. | |
size_t | peek (void *, size_t, size_t) noexcept override |
Read from the source but do not modify the internal offset. | |
size_t | read (void *, size_t) noexcept override |
Read from the source. | |
uint64_t | tellg () const noexcept override |
Returns the input position indicator, similar to std::basic_istream. | |
std::string | to_string () const noexcept override |
![]() | |
ByteInStream () noexcept | |
ByteInStream (const ByteInStream &)=delete | |
~ByteInStream () noexcept override=default | |
size_t | discard (size_t N) noexcept |
Discard the next N bytes of the data. | |
virtual std::string | id () const noexcept |
return the id of this data source | |
ByteInStream & | operator= (const ByteInStream &)=delete |
bool | peek (uint8_t &out) noexcept |
Peek at one byte. | |
bool | read (uint8_t &out) noexcept |
Read one byte. | |
![]() | |
iostate_func () noexcept | |
iostate_func (const iostate_func &o) noexcept=default | |
iostate_func (iostate_func &&o) noexcept=default | |
virtual | ~iostate_func () noexcept=default |
bool | bad () const noexcept |
Checks if a non-recoverable error has occurred. | |
virtual void | clear (const iostate state=iostate::goodbit) noexcept |
Clears state flags by assignment to the given value. | |
bool | eof () const noexcept |
Checks if end-of-file has been reached. | |
bool | fail () const noexcept |
Checks if an error has occurred. | |
bool | good () const noexcept |
Checks if no error nor eof() has occurred i.e. | |
operator bool () const noexcept | |
Checks if no error has occurred, synonym of !fail(). | |
bool | operator! () const noexcept |
Checks if an error has occurred, synonym of fail(). | |
iostate_func & | operator= (const iostate_func &o) noexcept=default |
iostate_func & | operator= (iostate_func &&o) noexcept=default |
virtual iostate | rdstate () const noexcept |
Returns the current state flags. | |
void | setstate (const iostate state) noexcept |
Sets state flags, by keeping its previous bits. | |
bool | timeout () const noexcept |
Checks if a timeout (non-recoverable) has occurred. | |
Additional Inherited Members | |
![]() | |
constexpr iostate | rdstate_impl () const noexcept |
constexpr void | setstate_impl (iostate state) const noexcept |
Secure Memory-Based byte input stream.
Definition at line 290 of file byte_stream.hpp.
|
explicit |
Construct a secure memory source that reads from a string.
in | the string to read from |
Definition at line 133 of file byte_stream.cpp.
|
inline |
Construct a secure memory source that reads from a byte array.
in | the byte array to read from |
length | the length of the byte array |
Definition at line 309 of file byte_stream.hpp.
|
inlineexplicit |
Construct a secure memory source that reads from a secure_vector.
in | the MemoryRegion to read from |
Definition at line 316 of file byte_stream.hpp.
|
inlineexplicit |
Construct a secure memory source that reads from a std::vector.
in | the MemoryRegion to read from |
Definition at line 323 of file byte_stream.hpp.
|
inlineoverridenoexcept |
Definition at line 330 of file byte_stream.hpp.
|
nodiscardoverridevirtualnoexcept |
Read from the source.
Moves the internal offset so that every call to read will return a new portion of the source.
Use available() to try to wait for a certain amount of bytes available.
This method shall only block until min(available, length)
bytes are transfered.
See details of the implementing class.
out | the byte array to write the result to |
length | the length of the byte array out |
Implements jau::io::ByteInStream.
Definition at line 106 of file byte_stream.cpp.
|
nodiscardoverridevirtualnoexcept |
Read from the source but do not modify the internal offset.
Consecutive calls to peek() will return portions of the source starting at the same position.
out | the byte array to write the output to |
length | the length of the byte array out |
peek_offset | the offset into the stream to read at |
Implements jau::io::ByteInStream.
Definition at line 123 of file byte_stream.cpp.
|
overridevirtualnoexcept |
Return whether n bytes are available in the input stream, if has_content_size() or using an asynchronous source.
If !has_content_size() and not being an asynchronous source, !end_of_data() is returned.
Method may be blocking when using an asynchronous source up until the requested bytes are available.
A subsequent call to read() shall return immediately with at least the requested numbers of bytes available, if has_content_size() or using an asynchronous source.
See details of the implementing class.
n | byte count to wait for |
Implements jau::io::ByteInStream.
Definition at line 119 of file byte_stream.cpp.
|
inlineoverridevirtualnoexcept |
Checks if the stream has an associated file.
Implements jau::io::ByteInStream.
Definition at line 326 of file byte_stream.hpp.
|
overridevirtualnoexcept |
Close the stream if supported by the underlying mechanism.
Implements jau::io::ByteInStream.
Definition at line 139 of file byte_stream.cpp.
|
inlineoverridevirtualnoexcept |
Returns the input position indicator, similar to std::basic_istream.
Implements jau::io::ByteInStream.
Definition at line 332 of file byte_stream.hpp.
|
inlineoverridevirtualnoexcept |
Returns true if implementation is aware of content_size(), otherwise false.
Implements jau::io::ByteInStream.
Definition at line 334 of file byte_stream.hpp.
|
inlineoverridevirtualnoexcept |
Returns the content_size if known.
Implements jau::io::ByteInStream.
Definition at line 336 of file byte_stream.hpp.
|
overridevirtualnoexcept |
Implements jau::io::ByteInStream.
Definition at line 145 of file byte_stream.cpp.