title: Android: Read and Write Primitive Types to Internal Storage
body: <p>Is is possible to read and write primitive datatypes to/from a file in internal storage?</p>
  
  <p>I've found plenty of tutorials and examples for using read(bytes[]) and similar functions, but nothing for reading and writing, for example, data members for a class, or a bunch of ints, doubles, and Strings. Relying on a function that blindly reads some number of bytes and then trying to parse the result with offsets and typecasting seems very non-Android to me, but I can't seem to find an alternative.</p>
  
  <p>Perhaps I'm attempting to use the wrong tool for the wrong job and that's why I'm running into this roadblock. I'm writing an app that connects via BluetoothLE (using probably the worst API I've ever seen, but that's what the project requirements called for so I'm stuck with it), and after I connect to a device, I want to save the device's "name" which appears to be something akin to a MAC address but for Bluetooth, and the next time I see the device I want to display its "Friendly Name" which is a more human-readable name that I will know after connecting to the device for the first time. This lets me display the friendly name for a device that has been connected to before - and skip an authentication step. Is there, perhaps, a better mechanism than internal storage to store this kind of data? i.e. a few strings and an int.</p>