aboutsummaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Add jau::codec::base::ascii38_alphabet: Drop lower case letters suitable for ↵Sven Gothel2022-09-061-0/+39
| | | | | | unique vfat filename and use it for temp-dir Base 38 is still big enough to provide > INT_MAX @ 6 digits.
* jau::remove_if(): Use non-ambiguous jau::find_if() (clang 13 error)Sven Gothel2022-09-061-1/+1
|
* Variable integer base coding and fixed binary base 64 coding in C++ ↵Sven Gothel2022-09-063-45/+566
| | | | `jau::codec::base` and Java `org.jau.util.BaseCodec`
* variable radix encoding: Move 62 -> 64 base, using rfc4648 `URL and Filename ↵Sven Gothel2022-09-031-12/+12
| | | | | | | safe` Base 64 Alphabet, but keep natural order of value Used Base 64 safe alphabet: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_`, i.e. leaving `=` open for padding etc - if so desired in the future for block encoding.
* variable radix conversion: Overload for int64_t `dec_to_radix()`, validate ↵Sven Gothel2022-09-031-2/+3
| | | | base, enhance tests
* Add `dec_to_radix()` and `radix_to_dec()` variable radix from and to decimal ↵Sven Gothel2022-09-031-0/+44
| | | | encoding (Java/C++)
* Complete full `jau::fs::mount()` and `umount()`Sven Gothel2022-08-311-13/+125
|
* ByteInStream_URL: Utilize `url_header_sync` and wait for header completion @ ↵Sven Gothel2022-08-301-0/+1
| | | | | | | | | | | | | | | available and read Header completion (or stream failure) wait_until_completion() shall be passed before querying available() to properly utilize m_content_size (early out or blocking wait). Similar at read(), where wait_until_completion() shall be passed before testing end_of_data(), i.e. !good(). The latter uses ByteInStream_URL's own rdstate() override and queries m_content_size if m_has_content_length. Further blocking read is utilized if m_has_content_length (and not end_of_data()), otherwise only non-blocking read is possible.
* async read_url_stream(): Add `url_header_sync` object to notify user whether ↵Sven Gothel2022-08-301-2/+51
| | | | | | | | | | | | | header is complete (or an error occured, i.e. past header streaming stage) `url_header_sync` allows user to wait until the url streamed header is completed, either - Final (http) CRLF message received - Any http header error response received - First data package received - End of operation This way content_size can be awaited and acted accordingly at read, e.g. a blocking read w/ content_size.
* ringbuffer: Add write interrupt, close() interrupting r/w ops, check ↵Sven Gothel2022-08-281-41/+133
| | | | | | | | | | capacity upfront for r/w ops - write interrupt added similar to read interrupt as required to unblock write - close() interrupting r/w ops added, required to end any operation for out-of-thread closing - check capacity upfront for r/w ops, avoiding post close() r/w ops
* helper_jni: Add convert_vector_bytes_to_jarraylist() and ↵Sven Gothel2022-08-081-0/+13
| | | | convert_bytes_to_jbytearray<T>()
* C++ bytesHexString(): Add template variant for container, i.e. std::vector<> ↵Sven Gothel2022-08-081-0/+9
| | | | types for convenience
* Add `[[nodiscard]]` to Byte{In,Out}Stream read(), peek(), write() interface ↵Sven Gothel2022-08-051-26/+23
| | | | and all specializations, refine single byte API
* Add ByteOutStream and ByteOutStream_File POSIX 'fd' implementation, ...Sven Gothel2022-08-051-6/+159
| | | | | | - Add ByteOutStream interface - Add ByteOutStream_File implementation similar to ByteInStream_File, based on POSIX fd etc. - Add is_open() to ByteInStream and ByteOutStream interface.
* io_util/byte_stream: Decouple from Botan, add iostate and new Byte*Stream* ↵Sven Gothel2022-08-052-283/+240
| | | | | | | | | | | | | | | | | | | | | | | | | | super iostate_func class for std::basic_ios's iostate functionality The burden of having a compile time header dependency to ByteInStream is too high and may cause 'confusion' if linking unit w/ different settings - to say the very least! In case Botan::DataSource is required, user shall wrap ByteInStream into such desired types. +++ Don't include any iostream header. std::basic_ios's iostate functionality allows us to reuse the std spec for our streaming classes, enforcing a well specified iostate to be defined either by just setting the iostate at read() for non-async sources like file or by dynamical evaluation via rdstate() override for async sources. Use shorter method names, eg check_available() -> available() and iostream affine names, eg bytes_read() -> tellg(). Use 'void*' buffer types for read() and peak(), similar to POSIX, removing the burden for a nonsense cast. Drop ByteInStream_istream.
* jau::cow_iterator<>: Don't include iostreamSven Gothel2022-08-051-1/+0
|
* helper_jni.hpp: Fix from_jboolean_to_bool() protoSven Gothel2022-08-051-1/+1
|
* file_util: fix mem leak, robustness changesSven Gothel2022-08-051-0/+6
| | | | | | | | | - jau::fs::to_named_fd(): Describe stdio names - file_stats::file_stats - fix mem leak: Use std::vector<char> for temp buffer, no need to miss ::free() - initialize dir_item item late via assignment (use default ctor first) - statx(linux): Only set size if has(field_t::size) - to_string(): Show size n/a, if n/a
* fraction<>::to_string(): Replace std::ostringstream precision w/ snprintf()Sven Gothel2022-08-051-5/+12
|
* cpp_pragma.hpp: Add PRAGMA_DISABLE_WARNING_FORMAT_NONLITERALSven Gothel2022-08-051-0/+3
|
* jau::io::read_stream(): Guarantee consumer_fn() is called with ↵Sven Gothel2022-08-021-0/+9
| | | | `is_final=true` once at the end, even if input stream has zero size
* ByteInStream_File: Remove obsolete `use_binary` arg, byte streams are always ↵Sven Gothel2022-07-311-7/+5
| | | | binary; Java: Add dirfd and fd ctor variants
* Add jau::io::read_stream() with double-buffered reading to ensure last ↵Sven Gothel2022-07-311-0/+23
| | | | | | | consumer_fn() call gets is_final set if next buffer has eof() w/ zero bytes. This behavior is required for certain operations, i.e. where we cannot have a zero-sized consumer_fn() call as is_final=true. Example: cipherpack using Botan API, where AEAD::finish() requires the last Tag bytes to be delivered.
* ByteInStream_File: Replace `std::ifstream` for file-descriptor (fd) POSIX ↵Sven Gothel2022-07-311-6/+113
| | | | | | | | | | | | | | | | | | | layer to support dirfd and plain fd operations For state tracking, jau::io::iostate mimics std::iobase::iostate, only if read reaches eof we do not additionally set failbit! ctor ByteInStream_File(dirfd, rel_path) is being used for cipherpack's hash calc method, i.e. to be robust against moving directories. Further it handles fifo/pipe in a well defined manner, not by chance. TODO: Figure out when to set irrecoverable badbit for media error. As of now, we only set failbit on logic errors etc. TODO: Figure out ByteInStream_File::peek() - add unit test - use pread() with offset instead of seek/read.
* file_stats: Support new fmode_t types sock, blk, chr and fifo, move fd from ↵Sven Gothel2022-07-311-30/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type -> attribute, support sole file_stats(fd) ctor, ... A file descriptor (fd) is not a fmode_t type, but an attribute clarifying if instance was constructed via a fd w/o a path (including named fd) or not. Hence is_fd() -> has_fd(), useful to avoid ::remove() a file. For example, stdin could be either a file, a chr (terminal) or a fifo (pipe) where all variants are has_fd() == true and size() == 0. +++ Allow instantiation via a sole fd, as required for upcoming pure fd handling. Taking benefit of the POSIX openat() function group using AT_EMPTY_PATH and an empty path. Note that readlinkat() just uses an empty path as the signal for using dirfd alone. +++ fix named pipe handling: If detecting a named-fd (could be still a link type as well), simply use the resulting fd and open it via stat(). This avoid issues: - on FreeBSD where opening the named-fd itself gives the wrong fmode_t (always chr instead of fifo) - on Linux where the final fifo/pipe file can't be opened.
* helper_jni.hpp: Add jau::jni::getIntFieldValue()Sven Gothel2022-07-311-0/+1
|
* Add traverse_options::lexicographical_order as required when computing an ↵Sven Gothel2022-07-291-2/+5
| | | | | | | order dependent outcome like a hash value Implementation only performs the default sort algo on the dir_item::basename() for each directory, when recursing through the directories.
* Add jau::fs::sync() / FileUtil.sync(): Synchronizes filesystems ...Sven Gothel2022-07-291-0/+5
|
* jau::fs::copy_option / CopyOption: Add into_existing_dir: Copy source dir ↵Sven Gothel2022-07-291-1/+9
| | | | content into an already existing destination directory as if destination directory did not exist
* jau::service_runner: Cleanup pthread and signal usage: Include header and ↵Sven Gothel2022-07-261-2/+7
| | | | use global namespace
* Pipe dreams: Add support for (named) file descriptor: jau::fs::file_stat and ↵Sven Gothel2022-07-232-13/+67
| | | | | | | | | | | | | | | | | | jau::io::ByteInStream_File, ... as well as considering file_stat::is_fd() in - jau::fs::remove(): Deletion not allowed jau::io::ByteInStream_File: - If source path denotes a named file descriptor, i.e. jau::fs::file_stats::is_fd() returns true, has_content_size() returns false and check_available() returns true as long the stream is open and EOS hasn't occurred. Note: file_stat::is_fd() and file_stat::is_file() are orthogonal. +++ This work is covered to allow stream-processing via pipes (e.g. stdin/stdout). Current use-case is cipherpack's encryption/decryption streaming.
* copy_options::ignore_symlink_errors: Also ignore symlinks if not supported ↵Sven Gothel2022-07-201-2/+5
| | | | by target filesystem if not using follow_symlinks (e.g.: vfat target)
* fraction_timespec::to_iso8601_string(), file_stats::to_string(): Drop ↵Sven Gothel2022-07-202-8/+6
| | | | 'use_space' parameter and print UTC ISO8601 w/ nanoseconds if not zero
* Fix fraction_timespec::normalize(): tv_nsec and tv_sec shall use same sign, ↵Sven Gothel2022-07-201-11/+18
| | | | fix sign alignment and nsec multiples of sec; Fix sign() considering 0 sec and abs() accordingly.
* Data-Race-Free (DRF) jau::fs::visit(): Use `dirfd` operations throughout ↵Sven Gothel2022-07-191-4/+23
| | | | visitor process as used by copy() and remove(), removing any transaction 'holes'
* Add jau::fs::rename() (C++) / FileUtil.rename() (Java)Sven Gothel2022-07-181-0/+18
|
* Data-Race-Free (DRF) jau::fs::copy() and remove(): Use `dirfd` `openat()` ↵Sven Gothel2022-07-181-8/+50
| | | | | | | | | | | | | | | | | | etc operations and temp-dir for newly dirs (copy) until dirfd retrieved and permissions dropped Further .. - add and use dir_item() w/ expicit clean dir- and basename - file_stats ctor with `dirfd` variant DRF is achieved via `dirfd` `openat()` etc operations, avoiding mutations while directories are processed. See jau::fs::copy() and jau::fs::remove() API doc +++ Added jau::fs::copy() test `test41_copy_ext_r_p_below()`, with recursive copy below given and existing destination directory.
* Add cpuid.hpp (SysUtils), namespace jau::cpu: Query cpu_family and ↵Sven Gothel2022-07-111-0/+314
| | | | arm/aarch64 hwcaps using glibc/Linux 'getauxval()' (todo: x86, x86_64 via cpuid)
* jau/debug.hpp: Fix dependency, include jau/int_types.hpp for jau::snsize_tSven Gothel2022-07-111-0/+1
|
* Java: Move 'org.jau.nio' content -> 'org.jau.io' and 'org.jau.nio.Uri' -> ↵Sven Gothel2022-07-071-2/+2
| | | | ''org.jau.nio.UriTk'; C++: 'jau::io::uri' -> 'jau::io::uri_tk'
* mount/umount: Cover `testsudo_fileutils02.cpp` with ↵Sven Gothel2022-07-051-2/+4
| | | | `TestsudoFileUtils02.java`; API-doc: Detail mount/umount capabilities (alt to sudo)
* Complete C++ jau::fs -> java org.jau.fs mapping incl. full ↵Sven Gothel2022-07-041-0/+26
| | | | test_fileutils01.cpp -> TestFileUtils01.java
* Complete file_util: dir_item def ctor and equality op; file_stat equality ↵Sven Gothel2022-07-041-9/+24
| | | | | | op; Drop 'verbose' param for touch(); Use ERR_PRINT() on errors. Also test touch() w/ current time timestamps, i.e. w/o atime nor mtime variant.
* fraction_timespec: Add sign() and abs()Sven Gothel2022-07-041-0/+22
|
* test_bytestream (C++, Java): Byte-compare source w/ destination; Java: Add ↵Sven Gothel2022-06-281-0/+10
| | | | | | | | | | | | | | | | | FileUtil mapping jau::fs::file_util.hpp functionality - FileUtil.compare() is covered via TestByteStream01 - Not mapped: - dir_item - fmode_t - file_stats TODO - Test CopyOptions and TraverseOptions - Partially copy test_fileutils01.cpp and testsudo_fileutils02.cpp - copy() - remove() - mount_image()
* Make io-tests flexible to detected whether protocol is supported ↵Sven Gothel2022-06-281-0/+4
| | | | (-DUSE_LIBCURL=ON or not)
* Fix rethrow_and_raise_java_exception_jau(E) macro, use jau::jni namespace in ↵Sven Gothel2022-06-261-1/+2
| | | | call; Add convert_vector_stringview_to_jarraylist() variant
* ByteInStream_Feed: Fix deletion of copy-ctor and assignment operatorSven Gothel2022-06-261-3/+3
|
* jau::io::uri: Cleanup API doc, remove 'view' impl detail in descriptionSven Gothel2022-06-261-7/+7
|
* jau::fs::dir_item::backed_string_view: Adopt to clang's inability to ↵Sven Gothel2022-06-251-4/+63
| | | | std::move() a std::string w/o copy, clang >= 11