Code example for RandomAccessFile

Methods: close, length, readFully

0
        } 
        return serverURL;
    } 
 
    private static String readPreferenceFile(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 writepreferenceFile(File installation, String url) throws IOException {
        FileOutputStream out = new FileOutputStream(installation);
        out.write(url.getBytes());
        out.close();
        Log.d("krha", "Saving URL to File : " + url);
    } 
     
    public static void updateServerURL(String url){
    	serverURL = url;