java读取文本文件的方法有很多 这个例子主要介绍最简单 最常用的BufferedReader类 完整例子如下 package net chinaunix blog hzm textimport java io BufferedReaderimport java io FileReaderimport java io IOExceptionpublic class ReadFile {private String pathpublic ReadFile(String filePath){path = filePath}public String[] openFile() throws IOException{FileReader fr = new FileReader(path) BufferedReader textReader = new BufferedReader(fr) String[] textData = new String[readLines()]int ifor(i= i <readLines() i++){textData[i] = textReader readLine() }textReader close() return textData}int readLines() throws IOException{FileReader fileToRead = new FileReader(path) BufferedReader bf = new BufferedReader(fileToRead) int numberOfLines = @SuppressWarnings( unused )String oneLinewhile((oneLine = bf readLine()) != null){numberOfLines++}bf close() return numberOfLines}}package net chinaunix blog hzm textimport java io IOExceptionpublic class FileData {public static void main(String[] args) throws IOException{String filePath = C:/text txt try{ReadFile reader = new ReadFile(filePath) String[] content = reader openFile() int ifor(i= i<content lengthi++){System out println(content[i]) }}catch(IOException e){System out println( 异常信息 + e getMessage()) }}}java io BufferedReaderThe buffer size may be specified or the default size may be used The default is large enough for most purposes In general each read request made of a Reader causes a corresponding read request to be made of the underlying character or byte stream It is therefore advisable to wrap a BufferedReader around any Reader whose read() operations may be costly such as FileReaders and InputStreamReaders For example BufferedReader in = new BufferedReader(new FileReader( foo in )) will buffer the input from the specified file Without buffering each invocation of read() or readLine() could cause bytes to be read from the file converted into characters and then returned which can be very inefficient Programs that use DataInputStreams for textual input can be localized by replacing each DataInputStream with an appropriate BufferedReader java io FileReaderFileReader is meant for reading streams of characters For reading streams of raw bytes consider using a FileInputStream lishixinzhi/Article/program/Java/hx/201311/26249
到目前为止,还没有一种反编译的方法可以获得百分百完整、准确的源代码。
EXE File英文全名executable file ,译作可执行文件,可移植可执行 (PE) 文件格式的文件,它可以加载到内存中,并由 *** 作系统加载程序执行,是可在 *** 作系统存储空间中浮动定位的可执行程序。如记事本程序notepad.exe ,可以用来编辑文档,如:测试.txt双击打开notepad.exe记事本程序来进行编辑处理。
源代码(Open source code)也称为源代码公开,指的是一种软件发布模式。一般的软件仅可取得已经过编译的二进制可执行档,通常只有软件的作者或著作权所有者等拥有程序的原始码。
评论列表(0条)