⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 randomaccessexample.java

📁 java 完全探索的随书源码
💻 JAVA
字号:
import java.io.*;class RandomAccessExample{  public static void main( String[] args )  {    if ( args.length != 1 )    {      System.out.println( "Usage: java RandomAccessExample <textfile>" );      System.exit( 0 );    }    String fileName = args[0];    try    {      // Create a random access file for read only      RandomAccessFile file = new RandomAccessFile( fileName, "r");      long filePointer = 0;      long length = file.length();      // Keep going through the file until we reach the length of the file      while ( filePointer < length )      {        String s = file.readLine();        System.out.println(s);        filePointer = file.getFilePointer();      }    }    catch ( IOException ex )    {      ex.printStackTrace();    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -