码迷,mamicode.com
首页 > 数据库 > 详细

2020.03.04 io流练习题2(Randomaccessfile类)

时间:2020-03-04 20:59:27      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:stringbu   port   cep   yun   microsoft   length   view   ace   rac   

package com.guoyun.view;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

/**
* ClassName:
* Function: ADD FUNCTION
* Reason: ADD REASON
*
* @author
* @Date
* @since Ver 1.1
*/
public class Test25 {
public static void main(String[] args) {
RandomAccessFile raf=null;
StringBuffer sb=new StringBuffer();
try {
raf=new RandomAccessFile(new File("hello.txt"),"r");
// System.out.println(raf.length());
int temp=0;

for (int i = (int) raf.length()-1; i >=0 ; i--) {
raf.seek(i);
System.out.println((char) raf.read());

}

} catch (Exception e) {
e.printStackTrace();
}finally {
try {
raf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

2020.03.04 io流练习题2(Randomaccessfile类)

标签:stringbu   port   cep   yun   microsoft   length   view   ace   rac   

原文地址:https://www.cnblogs.com/aojie/p/12411977.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!