Code example for RandomAccessFile

Methods: close, length, readFully

0
		} 
		return sID;
	} 
 
	private static String readInstallationFile(File installation) throws IOException {
		RandomAccessFile f = new RandomAccessFile(installation, "r");
		byte[] bytes = new byte[(int) f.length()];
		f.readFully(bytes);
		f.close();
		return new String(bytes);
	} 
 
	private static void writeInstallationFile(File installation) throws IOException {
		FileOutputStream out = new FileOutputStream(installation);
		String id = UUID.randomUUID().toString();
		out.write(id.getBytes());
		out.close();
	} 
	 
	public static String getDeviceId(Context context){
		// Interesting discussion about getting a DeviceId