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(); } } }}
原文地址:https://www.cnblogs.com/aojie/p/12411977.html
时间: 2024-11-03 11:52:42