LineNumberReader 指定文件编码

<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->
import  java.io.FileInputStream;
import  java.io.IOException;
import  java.io.InputStreamReader;
import  java.io.LineNumberReader;


public   class  Main {
    
    
public   static   void  main(String[] args)  throws  IOException {

        InputStreamReader isr 
=   new  InputStreamReader( new  FileInputStream( " 15370720.pdf4 " ),  " utf-16 " );
        LineNumberReader lnr
= new  LineNumberReader(isr);
        String line 
=   null ;
        
while ((line = lnr.readLine()) != null ){  
           System.out.println(lnr.getLineNumber()
+ " \t " + line);
        }
   }
}

你可能感兴趣的:(LineNumberReader 指定文件编码)