In my application I have begun to use data files as resources in order to read in the game specific data that I need for the app. My question is - is my java code converting the textfiles of data into the correct format as I have ten different .txt files which I convert into binary format but once this is done each of the ten converted data files are slightly bigger than each of the equivelant .txt files. I realise that the reading in of the data in this format is quicker for the j2me app and that it is better to have all your game data into these data files for localisation and for heap memory etc but I also assumed that the actual size of a converted data file would be smaller than the .txt file it had been converted from?
Is this correct and am I converting the txt files in the correct manner i.e. (I am requiring the text files to be in UTF 8 format):
//Main idea of how the .txt files are being converted
ByteArrayOutputStream bout = new ByteArrayOutputStream();
DataOutputStream dout = new DataOutputStream( bout );
dout.writeUTF(buffer);
dout.writeInt( Integer.parseInt(buffer) );
dout.flush();
bout.reset();
dout.close();
Thanks for any valuable advice