Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
|
File based byte output stream, including named file descriptor. More...
#include <byte_stream.hpp>
Public Member Functions | |
ByteOutStream_File (const ByteOutStream_File &)=delete | |
ByteOutStream_File (const int dirfd, const std::string &path, const jau::fs::fmode_t mode=jau::fs::fmode_t::def_file_prot) noexcept | |
Construct a stream based byte output stream from filesystem path and parent directory file descriptor, either an existing or new file. More... | |
ByteOutStream_File (const int fd) noexcept | |
Construct a stream based byte output stream by duplicating given file descriptor. More... | |
ByteOutStream_File (const std::string &path, const jau::fs::fmode_t mode=jau::fs::fmode_t::def_file_prot) noexcept | |
Construct a stream based byte output stream from filesystem path, either an existing or new file. More... | |
~ByteOutStream_File () noexcept override | |
void | close () noexcept override |
Close the stream if supported by the underlying mechanism. More... | |
int | fd () const noexcept |
Returns the file descriptor if is_open(), otherwise -1 for no file descriptor. More... | |
std::string | id () const noexcept override |
return the id of this data source More... | |
bool | is_open () const noexcept override |
Checks if the stream has an associated file. More... | |
ByteOutStream_File & | operator= (const ByteOutStream_File &)=delete |
uint64_t | tellp () const noexcept override |
Returns the output position indicator. More... | |
std::string | to_string () const noexcept override |
size_t | write (const void *, size_t) noexcept override |
Write to the data sink. More... | |
Public Member Functions inherited from jau::io::ByteOutStream | |
ByteOutStream ()=default | |
ByteOutStream (const ByteOutStream &)=delete | |
~ByteOutStream () noexcept override=default | |
virtual void | close () noexcept=0 |
Close the stream if supported by the underlying mechanism. More... | |
virtual std::string | id () const noexcept |
return the id of this data source More... | |
virtual bool | is_open () const noexcept=0 |
Checks if the stream has an associated file. More... | |
ByteOutStream & | operator= (const ByteOutStream &)=delete |
virtual uint64_t | tellp () const noexcept=0 |
Returns the output position indicator. More... | |
virtual std::string | to_string () const noexcept=0 |
bool | write (const uint8_t &in) noexcept |
Write one byte. More... | |
virtual size_t | write (const void *in, size_t length) noexcept=0 |
Write to the data sink. More... | |
Public Member Functions inherited from jau::io::iostate_func | |
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. More... | |
virtual void | clear (const iostate state=iostate::goodbit) noexcept |
Clears state flags by assignment to the given value. More... | |
bool | eof () const noexcept |
Checks if end-of-file has been reached. More... | |
bool | fail () const noexcept |
Checks if an error has occurred. More... | |
bool | good () const noexcept |
Checks if no error nor eof() has occurred i.e. More... | |
operator bool () const noexcept | |
Checks if no error has occurred, synonym of !fail(). More... | |
bool | operator! () const noexcept |
Checks if an error has occurred, synonym of fail(). More... | |
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. More... | |
void | setstate (const iostate state) noexcept |
Sets state flags, by keeping its previous bits. More... | |
bool | timeout () const noexcept |
Checks if a timeout (non-recoverable) has occurred. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from jau::io::iostate_func | |
constexpr iostate | rdstate_impl () const noexcept |
constexpr void | setstate_impl (iostate state) const noexcept |
File based byte output stream, including named file descriptor.
Definition at line 860 of file byte_stream.hpp.
|
noexcept |
Construct a stream based byte output stream from filesystem path, either an existing or new file.
In case the file already exists, the underlying file offset is positioned at the end of the file.
In case the given path is a local file URI starting with file://
, see jau::io::uri::is_local_file_protocol(), the leading file://
is cut off and the remainder being used.
path | the path to the file, maybe a local file URI |
mode | file protection mode for a new file, otherwise ignored. |
Definition at line 719 of file byte_stream.cpp.
|
noexcept |
Construct a stream based byte output stream from filesystem path and parent directory file descriptor, either an existing or new file.
In case the file already exists, the underlying file offset is positioned at the end of the file.
In case the given path is a local file URI starting with file://
, see jau::io::uri::is_local_file_protocol(), the leading file://
is cut off and the remainder being used.
dirfd | parent directory file descriptor |
path | the path to the file, maybe a local file URI |
mode | file protection mode for a new file, otherwise ignored. |
Definition at line 682 of file byte_stream.cpp.
|
noexcept |
Construct a stream based byte output stream by duplicating given file descriptor.
In case the given path is a local file URI starting with file://
, see jau::io::uri::is_local_file_protocol(), the leading file://
is cut off and the remainder being used.
fd | file descriptor to duplicate leaving the given fd untouched |
Definition at line 665 of file byte_stream.cpp.
|
delete |
|
inlineoverridenoexcept |
Definition at line 930 of file byte_stream.hpp.
|
inlineoverridevirtualnoexcept |
Checks if the stream has an associated file.
Implements jau::io::ByteOutStream.
Definition at line 872 of file byte_stream.hpp.
|
overridevirtualnoexcept |
Write to the data sink.
Moves the internal offset so that every call to write will be appended to the sink.
This method is not blocking beyond the transfer length bytes.
in | the input bytes to write out |
length | the length of the byte array in |
Implements jau::io::ByteOutStream.
Definition at line 634 of file byte_stream.cpp.
|
inlineoverridevirtualnoexcept |
return the id of this data source
Reimplemented from jau::io::ByteOutStream.
Definition at line 876 of file byte_stream.hpp.
|
inlinenoexcept |
Returns the file descriptor if is_open(), otherwise -1 for no file descriptor.
Definition at line 883 of file byte_stream.hpp.
|
delete |
|
overridevirtualnoexcept |
Close the stream if supported by the underlying mechanism.
Implements jau::io::ByteOutStream.
Definition at line 722 of file byte_stream.cpp.
|
inlineoverridevirtualnoexcept |
Returns the output position indicator.
Implements jau::io::ByteOutStream.
Definition at line 932 of file byte_stream.hpp.
|
overridevirtualnoexcept |
Implements jau::io::ByteOutStream.
Definition at line 730 of file byte_stream.cpp.