ABSTRACT

Basic text files have the advantage of being simple. They are reasonably easy to program and the files themselves can be edited with a standard text editor. Unfortunately, they do not have any inherent meaning and they are very brittle to edit. Small mistakes can easily invalidate the whole file. These problems are corrected by using XML, which was introduced in chapter 10. Both flat text and XML have the downfall that they are slow and bloated in size. In these areas, XML is worse than flat text. To fix those problems we need to move in the opposite direction and go to binary files. Unfortunately, this move takes away the advantage that text and XML have that they can be read and edited easily with text editors. We saw how we could read and write in native binary in chapter 10 with the DataInputStream and DataOutputStream as well as how whole objects could be serialized to binary using ObjectInputStream and ObjectOutputStream.