Code example for RandomAccessFile

Methods: length, readFully

0
                } 
            } catch (ClassNotFoundException e) {
            } 
        } 
        try { 
            RandomAccessFile file = new RandomAccessFile(name + ".class", "r");
            byte data[] = new byte[(int) file.length()];
            file.readFully(data);
            c = defineClass(name, data, 0, data.length);
        } catch (IOException e) {
            System.out.println("Error reading file.");
        } 
        if (resolve) {
            resolveClass(c);
        } 
        return c;
    } 
}