Code example for RandomAccessFile

Methods: close, read, seek

0
            //raf.write(buf); 
            //raf.close(); 
            //raf = null; 
 
            // The data's almost certainly cached -- it's not clear what we're testing here 
            raf = new RandomAccessFile(filename, "r");
            raf.seek(0);
            raf.read(buf);
        } catch (IOException e) {
            Log.e(TAG, "File read failed", e);
        } finally { 
            try { if (raf != null) raf.close(); } catch (IOException e) {}
        } 
    } 
 
    // Returns milliseconds taken, or -1 on failure. 
    private long settingsWrite(int mode) {
        Cursor c = null;
        long startTime = SystemClock.uptimeMillis();
        // The database will take care of replacing duplicates. 
        try {