第1个回答 2012-02-18
public static void testReadFile(){
RandomAccessFile raf = null;
try {
raf = new RandomAccessFile("c:/out.txt", "r");
//跳过字节数
raf.skipBytes(32);
//读取一个数字
int num = raf.readInt();
System.out.println(num);
raf.close();
} catch (Exception e) {
e.printStackTrace();
}
}
第2个回答 2012-02-18
byte[] buff=new byte[4];
try {
DataInputStream dis=new DataInputStream(new FileInputStream(new File("c:/rr.ifo")));
dis.skip(32);
dis.read(buff);
ByteArrayInputStream bintput = new ByteArrayInputStream(buff);
int f = bintput.read();
System.out.println(f);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}本回答被提问者采纳