ABSTRACT

Back in chapter 9 we learned about basic text files. These had the advantage of being simple. They were reasonably easy to program and the files themselves could be edited with a standard text editor. Unfortunately, they did not have any inherent meaning and they were very brittle to edit. Small mistakes could easily invalidate the whole file. These problems were corrected by using XML starting with chapter 14. 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 22 with the DataInputStream and DataOutputStream as well as how whole objects could be serialized to binary using ObjectInputStream and ObjectOutputStream.