Read and write objects to various text formats in Java