I have two arrays that I'd like to save to file. An array of floats and an array of shorts (mesh data). I don't want to save these as characters because it makes the files unnecessarily large. The file will be loaded into both android and ios so the bytebuffer.nativeorder thing makes me nervous. Any suggestions, tips, warnings would be much appreciated.
float verts[x]
short indices[y]
I'd probably use DataOutputStream
- write out the number of vertices, then the vertices themselves. Then write out the number of indices, then the indices.
This will always use big-endianness, and should be easy enough to read/write on iOS, without worrying about native byte ordering.
See more on this question at Stackoverflow