String padding with String.format()
Get all available charsets in java
Get time unit in Java using TimeUnit
Externalize Log4j configuration
Loading Java Properties from file
Formatting date in Java
In this article we are going to see how to format a Date in java using the standard class
java.text.SimpleDateFormat
SimpleDateFormat
is a concrete class for formatting and parsing dates in a locale-sensitive manner. It allows for formatting (date -> text), parsing (text -> date), and normalization. SimpleDateFormat
allows you to start by choosing any user-defined patterns for date-time formatting. However, you are encouraged to create a date-time formatter with either getTimeInstance, getDateInstance, or getDateTimeInstance in DateFormat. Each of these class methods can return a date/time formatter initialized with a default format pattern. You may modify the format pattern using the applyPattern methods as desired.Hot-reload of properties file
In this post weโll see how to do hot-reload of properties file used by a web-application. Hot-reload is useful when we want change some property in a file without restart the application server (like JBoss). Restart an application-server (or servlet-container) means restart all the web-apps that are running under that application-server, with resulting unavailability of some sensible service. For this scope weโll use the Java class PropertiesConfiguration in the Apache Common Configuration library. This class allow to bind a properties file to an PropertiesConfiguration Java Object through which read the single properties.