JElementary - Java Elementary Utilities package
What is the Java Elementary Utilities package?JElementary is a Java library providing various elementary utility classes and methods. This includes general-purpose functionality that can be useful in just about any software project - ideally, the kind of stuff that would have been built-in in the JDK itself.
Rather than re-inventing many wheels, you can use these convenient utilities to preform elementary operations required by your application, leaving your own code focused on higher-level business logic instead.
The provided utilities include functionality related to strings, files, streams, reflection, containers (collections and other data structures), compression, concurrency, network, parsing, encodings, cryptography, spools, throttling, configuration, and even a lightweight JDBC wrapper to run your SQL queries without all the boilerplate code.
The library keeps growing, with more generic utilities added according to demand from various applications and users.
How do I use the Java Elementary Utilities package?The Java Elementary Utilities package is written in pure Java, runs on JDK 1.6 or later, and requires no special installation - just add the jar file to your classpath.
It is also available on Maven Central at the artifact coordinates
The source code contains elaborate documentation for the classes and methods it provides.
What's New?In version 2.0:
- Added Containers.toStringMap utility method.
- Added Containers.getColumn utility method.
- Added Containers.parseEnumSet/toString for converting EnumSets to/from strings.
- Added Strings.splitTable utility method.
- Added Strings.splitLines utility method.
- Added Strings.toDurationString/toVerboseDurationString utility methods.
- Added Strings.pad/padLeft/padRight/padZeros utility methods.
- Added Strings.repeat utility method.
- Added Strings.calculateLuhnCheckDigit/validateLuhnCheckDigit Luhn's algorithm methods.
- Fixed Strings.parseHexString edge cases.
- Added Streams.readLines utility method.
- Added Streams.serialize/deserialize utility methods.
- Added boolean and enum conversion to Reflect.convert.
- Added Utils.getBytes methods for converting int/long into an LSB/MSB byte array.
- Added LSB/MSB parameter to Utils.getU16/32/64 methods.
- Added Net.validateUrl utility method.
- Fixed Net.parseIP4Netmask handling of host name.
- Added LifeCycle interface.
- Added ConcurrentStack implementation.
- Added Arguments utility class for parsing command-line arguments and options.
- Added Crypto.hash/md5/sha1/sha256 overloaded methods accepting an InputStream.
- Fixed Crypto.createSSLContext closing of FileInputStream.
- Added Crypto.getBlockSize method for determining block size per algorithm.
- Changed Crypto.hmac to use getBlockSize instead of assuming 64.
- Added Crypto.hotp methods for calculating an RFC 4226 HOTP (HMAC-Based One-Time Password).
- Added Crypto.totp methods for calculating an RFC 6238 TOTP (Time-Based One-Time Password).
- Added Crypto command-line utility.
- Added Base32 utility class for encoding and decoding RFC 4648 compliant base32 and base32hex data.
- Added base64url encoding/decoding support to Base64 class.
- Added Base64 encoding/decoding convenience methods for UTF-8 content.
- Added DelegatingProxy.getTarget method to retrieve the original target object.
- Optimized DelegatingProxy using an efficient custom hashtable lookup for overridden methods.
- Added DBRunner.exec overload that accepts script as InputStream.
- Changed DBRunner.exec script execution to work with/without transaction and propagate exceptions.
- Removed redundant close parameter from DBRunner.exec.
- Refactored DBRunner.BeanResultsHandler/BeanListResultsHandler to make them more extensible.
- Made DBConnectionPool/DBManager/DBRunner implement Closeable.
- Added DBConnectionPool idle connection test after configured timeout to remove unused connections.
- Added caching of auto-commit mode in ConnectionWrapper to avoid unnecessary calls to DB.
- Optimized PreparedStatementWrapper to not unnecessarily close result set explicitly.
- Optimized DBConnectionPool by using ConcurrentStack instead of LinkedBlockingDeque.
- Added unexpected exception as the AssertionError cause in Tests.test.
- Improved javadocs and misc. minor refactorings.
In version 1.0:
- This is the first release of the Java Elementary Utilities package.
LicenseThe JElementary Package is provided under the GNU General Public License agreement.
For non-GPL commercial licensing please contact the author.
DonateIf you like it, why not give something back?
ContactYou can contact the author via e-mail at:
Please write in with any bugs, suggestions, fixes, contributions, or just to drop a good word and let me know you've found the JElementary Package useful and you'd like it to keep being maintained.
For updates and additional information, you can always visit the website at: