网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
FileInputStream和FileOutputStream错误的是()
- A、是字节流
- B、是节点流
- C、用其拷贝文件时,不能拷贝中文
- D、可以拷贝任何文本文件和2进制文件
参考答案
更多 “FileInputStream和FileOutputStream错误的是()A、是字节流B、是节点流C、用其拷贝文件时,不能拷贝中文D、可以拷贝任何文本文件和2进制文件” 相关考题
考题
请完成下列Java程序:读取自己的源文件并把它压缩成GZIP文件。注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。import java.io.*;import java.util.zip.*;public class exl6 2 {public static void main{String[] arg) {ex16_2 obj16_2 = new ex16_2();obj16_2.doZip("ex16_2.java","ex16_2.gzip")}public void doZip(String strIn,String strOutFileInputStream in;FileOutputStream out;GZIPOutputStream gzip;int nFileLength;byte[] barray = new byte[10];try {in = new FileInputStream(strIn);out = new FileOutputStream(strOut);gzip = new GZIPOutputStream(out);while((nFileLength = in.read(barray, 0 barray.length)) > 0)_____________________;______________________;gzip.close();} catch(Exception e) {e.printStackTrace();}}}
考题
下面关于java中输入/输出流的说法正确的是()。A.FileInputStream与FileOutputStream类用读、写字节流B.Reader与Writer类用来读、写字符流C.RandomAccessFile既可以用来读文件,也可以用来写文件D.File类用来处理与文件相关的操作
考题
下列( )不是FilterlnputStream的子类。A.CheckedInputStreamB.BufferedInputStreamC.PushbackInputStreamD.FileInputStream
考题
下列程序要求将source.txt文件中的字符,通过文件输入/输出流复制到另一个dest.txt文件中。请将程序补充完整。注意:不改动程序结构,不得增行或删行。import java.io.*;public class ex2{public static void main(String[] args) throws IOException{File inputFile;File outputFile;FileInputStream in;FileOutputStream out;int c;inputFile=new File("source.txt");utputFile=new File("dest.txt");in=new FileInputStream(inputFile);______(outputFile);while((c=in.read())!=-1)______;in.close();out.close();}}
考题
Java中处理压缩流的抽象类是A.InputStream和OutputStreamB.Reader和WriterC.InflaterInputStream和DeflaterOutputStreamD.FileInputStream和FileOutputStream
考题
要从文件“file.dar”文件中读出第10个字节到变量C中,下列哪个方法适合 ( )A.FileInputStream in=new FileInputStream("file.dar");in.skip9.;int c=in.read();B.FileInputStream in=new FileInputStream("file.dar");in.skip10.;int c=in.read();C.FileInputStream in=new FileInpmStream("file.dar");int c=in.read();D.Random AccessFile in=new RandomAceessFile("file.dar");in.skip9.;int c=in.readByte
考题
下列代码实现从文件file.dat中读出第5个字节到变量c中,横线处应该填入下列项中的______。 import java.io.*; public class exl5 { public static void main(String[] args) { try System.out.println((char)c); catch(Exception e) { e.printStackTrace(); } } }A.FileInputStream in = new FileInputStream("chl/file.dat"); in.skip(4); int c = in.read();B.FileInputStream in = new FileInputStream("chl/file.dat"); in.skip(5); int c = in.read();C.Fi2eInputStream in = new FileInputStream("file.dat"); int c = in.read();D.RandomAccessFile in = new RandomAccessFile ("chi/file. dat "); in.skip (4); int c = in.readByte();
考题
创建一个向文件“file.txt”追加内容的输出流对象的语句有()。A、FileOutputStream out=new FileOutputStream(“file.txt”,true);B、OutputStream out=new FileOutputStream(“file.txt”,“append”);C、OutputStream out=new FileOutputStream(“file.txt”);D、FileOutputStream out=new FileOutputStream(new file(“file.txt”));E、OutputStream out=new FileOutputStream(new File(“file.txt”),true.;
考题
在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。 A、BufferedReader breader=new BufferedReader(new FileReader("abc.txt"));B、PrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);C、FileInputStream fin = new FileInputStream(“abc.txt”);D、OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));
考题
Which two construct an OutputSream that appends to the file “file.txt”? ()A、 OutputStream out=new FileOutputStream(“file.txt”);B、 OutputStream out=new FileOutputStream(“file.txt”, “append”);C、 FileOutputStream out=new FileOutputStream(“file.txt”, true);D、 FileOutputStream out=new FileOutputStream(new file(“file.txt”));E、 OutputStream out=new FileOutputStream(new File(“file.txt”)true);
考题
Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?() A、FileOutputStream has no constructors matching the given arguments.B、An IOExeception will be thrown if a file named "data" already exists.C、An IOExeception will be thrown if a file named "data" does not already exist.D、If a file named "data" exists, its contents will be reset and overwritten.E、If a file named "data" exists, output will be appended to its current contents.
考题
要从文件" file.dat"文件中读出第10个字节到变量C中,下列哪个方法适合? ()A、 FileInputStream in=new FileInputStream("file.dat"); in.skip(9); int c=in.read();B、 FileInputStream in=new FileInputStream("file.dat"); in.skip(10); int c=in.read();C、 FileInputStream in=new FileInputStream("file.dat"); int c=in.read();D、 RandomAccessFile in=new RandomAccessFile("file.dat"); in.skip(9); int c=in.readByte();
考题
下列属于文件输入输出类的是()A、 FileInputStream和FileOutputStreamB、 BufferInputStream和BufferOutputStreamC、 PipedInputStream和PipedOutputStreamD、 以上都是
考题
要从文件"file.dat"中读出第10个字节到变量c中,下列哪个方法适合?()A、FileInputStream in=new FileInputStream("file.dat");in.skip(9);intc=in.read()B、FileInputStream in=new FileInputStream("file.dat");in.skip(10);intc=in.read()C、FileInputStream in=new FileInputStream("file.dat");intc=in.read()D、RandomAccessFile in=new RandomAccessFile("file.dat");in.skip(9);intc=in.readByte()
考题
Which two create an InputStream and open file the “file.txt” for reading? ()A、 InputStream in=new FileReader(“file.txt”);B、 InputStream in=new FileInputStream(“file.txt”);C、 InputStream in=new InputStreamFileReader (“file.txt”, “read”);D、 FileInputStream in=new FileReader(new File(“file.txt”));E、 FileInputStream in=new FileInputStream(new File(“file.txt”));
考题
多选题在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。ABufferedReader breader=new BufferedReader(new FileReader(abc.txt));BPrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);CFileInputStream fin = new FileInputStream(“abc.txt”);DOutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));
考题
单选题要从文件" file.dat"文件中读出第10个字节到变量C中,下列哪个方法适合? ()A
FileInputStream in=new FileInputStream(file.dat); in.skip(9); int c=in.read();B
FileInputStream in=new FileInputStream(file.dat); in.skip(10); int c=in.read();C
FileInputStream in=new FileInputStream(file.dat); int c=in.read();D
RandomAccessFile in=new RandomAccessFile(file.dat); in.skip(9); int c=in.readByte();
考题
多选题创建一个向文件“file.txt”追加内容的输出流对象的语句有()。AFileOutputStream out=new FileOutputStream(“file.txt”,true);BOutputStream out=new FileOutputStream(“file.txt”,“append”);COutputStream out=new FileOutputStream(“file.txt”);DFileOutputStream out=new FileOutputStream(new file(“file.txt”));EOutputStream out=new FileOutputStream(new File(“file.txt”),true.;
考题
单选题在J2ee中,以下各项中,()正确阐述了创建InputStreamReader的方式。A
new InputStreamReader(new FileInputStream(data));B
new InputStreamReader(new FileReaderdata));C
new InputStreamReader(new BufferedReader(data));D
new FileInputStream(data)
考题
单选题对于FileInputStream和FileOutputStream类,下面哪个方法不会产生IOException异常()A
二者的构造函数B
read()C
close()D
write()
考题
多选题Which two construct an OutputSream that appends to the file “file.txt”? ()AOutputStream out=new FileOutputStream(“file.txt”);BOutputStream out=new FileOutputStream(“file.txt”, “append”);CFileOutputStream out=new FileOutputStream(“file.txt”, true);DFileOutputStream out=new FileOutputStream(new file(“file.txt”));EOutputStream out=new FileOutputStream(new File(“file.txt”)true);
考题
单选题下列属于文件输入输出类的是()A
FileInputStream和FileOutputStreamB
BufferInputStream和BufferOutputStreamC
PipedInputStream和PipedOutputStreamD
以上都是
热门标签
最新试卷