- package com.**;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import org.junit.Test;
- public class TestFileInputOutputStream {
- @Test
- public void testFileInputStream1() throws IOException{
- File file = new File("a.txt");
- FileInputStream fis = new FileInputStream(file);
- int b = fis.read();
- while (b != -1) {
- System.out.print((char) b); }
- fis.close();
- }
- }
复制代码 |
|