Code example for RandomAccessFile

Methods: closelengthreadFully

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();
	} 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE