下列哪个选项定义了带有缓存的文件字节输入流
A: BufferedInputStream bis = new BufferedInputStream(new FileInputStream(...));
B: BufferedOutputStream bos = new BufferedOutputStream(new FileInputStream(...));
C: FileInputStream fis = new FileInputStream(new BufferedInputStream(...));
D: FileOutputStream fis = new FileOutputStream(new BufferedOutputStream(...));
A: BufferedInputStream bis = new BufferedInputStream(new FileInputStream(...));
B: BufferedOutputStream bos = new BufferedOutputStream(new FileInputStream(...));
C: FileInputStream fis = new FileInputStream(new BufferedInputStream(...));
D: FileOutputStream fis = new FileOutputStream(new BufferedOutputStream(...));
举一反三
- 下列写法错误的是 A: File f = new File ("a.txt"); B: File f = new File ("d:\\a.txt"); C: FileInputStream fis = new FileInputStream (new File ("a.txt")); D: FileOutputStream fos = new FileOutputStream ( File ("."));
- 新建一个流对象,下列( )选项的代码是错误的。 A: new BufferedWriter(new FileWriter("a.txt")); B: new BufferedReader(new FileInputStream("a.dat")); C: new DataOutputStream(new FileOutputStream("a.txt")); D: new ObjectInputStream(new FileInputStream("a.dat"));
- 阅读下列代码 import java.io.*; public class Example{ public static void main(String[] args) throws Exception { // 创建一个带缓冲区的输入流 BufferedInputStream bis = new BufferedInputStream(new ________( "src.txt")); // 创建一个带缓冲区的输出流 BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("des.txt")); int len; while ((len = bis.read()) != -1) { bos.write(len); } bis.close(); bos.close(); } } 请说出程序中,下划线位置的答案( )
- 新建一个流对象,下列( )选项的代码是错误的。 A: new BufferedWriter(new FileWriter("a.txt")); B: new BufferedReader(new FileInputStream("a.dat")); C: new DataOutputStream(new FileOutputStream("a.txt")); D: new ObjectInputStream(new FileInputStream("a.dat"));
- 要读一个较大的文件,下列创建对象的方法中哪个是最合适的?( ) A: new FileInputStream(“myfile.dat”); B: new InputStreamReader(new FileInputStream(“myfile.dat”)); C: new BufferedReader(new InputStreamReader(new FileInputStream(“myfile.dat”); D: new RandomAccessFile raf=new RandomAccessFile(new File(“myfile.dat”,”rw”));