InputStreamReader

/**

 * 用于读字符数据流

 * @author Chris

 */

public class ISRDemo {

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

FileInputStream fis = new FileInputStream("osw.txt");

InputStreamReader isr = new InputStreamReader(fis,"UTF-8");

int d =-1;

while ((d=isr.read())!=-1){

char c = (char) d;

System.out.print(c);

}

isr.close();

  }

}

你可能感兴趣的:(java,File)