//个人觉得这样也可以,不一定要使用RandomAccessFile来读取,现在许多人好象都喜欢这样,但完全可以使用其它流
            try
            {
                DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream("Test.java")));
                while(input.available() != 0)
                {
                    long a = input.readLong();
                    //你希望的操作。。
                }
            }
            catch (EOFException e)
            {
                System.out.println("It has reached the end of this file!");
            }
            catch (IOException e)
            {
                System.out.println("IOException");
            }
//以上代码编译通过,没有测试过,呵呵,希望对你有参考价值