Reading the contents of a file in Java is a very straightforward operation. The java tutorial explains completely how you can find your way to read different types of streams. However when you read an UTF-8 encoded file your fight will start. Most of the UTF-8 and UTF-16 encoded files contain a character at the beginning called BOM (byte-order mark). The BOM consists of a character  (U+FEFF) at the beginning of the stream used to define the byte order and the encoding of the stream. UTF encoded files may or may not contain the BOM. The problem with Java comes when […]

Reading UTF-8 encoded documents in java

When developing user interfaces for management software you usually need to check what the user inputs in order to store the values in a database or a file. Java offers different alternatives to parse a String (normally the way user inputs values to the system) to other data types. The class SimpleDateFormat from the package java.text offers a simple method to do this. You just have to call parse(String youDate) in order to get a java.util.Date. Following you can find some code which explains this method and some of its particularities: [crayon-59ebb7fc1fbf2050336676/]

SimpleDateFormat to check user date input // parsing String to ...