




已阅读5页,还剩131页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1 2020 3 27 第四讲Java的输入 输出系统 TheJavaIOSystem 2020 3 27 2 学习要点 流的概念流的分类各种流的区别及使用 2020 3 27 3 Java中的输入和输出 java io包封装Java的输入和输出操作Java中采用 流 的方式提供了输入和输出操作 java io包提供了永久保存对象状态的机制 2020 3 27 4 流 Stream 的概念 流可以看作是一个数据传递的通道通过流 数据按照顺序从源端送至目标端 2020 3 27 5 通过流读取数据 从某数据源中读取数据时 从数据源建立一个 流 然后从流中依次读取数据 2020 3 27 6 通过流写入数据 把数据写入到目标时 从目标端建立一个 流 然后将数据依次写入到流中 2020 3 27 7 流的类型 InputStream 输入流 可以从中读取数据的流称为输入流OutputStream 输出流 可以向其中写入数据的流称为输出流 2020 3 27 8 流中的数据 Java流中支持两种类型的数据字符字节根据流中支持的数据的不同 Java中的流分为两种字符流字节流 2020 3 27 9 字符流 字符流处理以字符为单位进行的读写操作 字符流处理的信息是基于文本的信息字符流支持Unicode中的任何字符Reader和Writer是处理字符流的两个基本类java io包中所有以 Reader 和 Writer 结尾的类都是处理字符流的类 2020 3 27 10 字符流类型的输入流 2020 3 27 11 字符流类型的输出流 2020 3 27 12 字节流 字节流处理以字节为单位进行的数据读写操作InputStream和OutputStream是处理字节流的两个基本类java io包中的所有以InputStream和OutputStream结尾的类都是处理字节流的类 2020 3 27 13 字节流类型的输入流 2020 3 27 14 字节流类型的输出流 2020 3 27 15 输入流的基本方法 Reader类的基本方法intread intread charcbuf intread charcbuf intoffset intlength InputStream类的基本方法intread intread bytecbuf intread bytecbuf intoffset intlength 2020 3 27 16 输出流的基本方法 Writer的基本方法intwrite intc intwrite charcbuf intwrite charcbuf intoffset intlength OutputStream的基本方法intwrite intc intwrite bytecbuf intwrite bytecbuf intoffset intlength 2020 3 27 17 流的打开和关闭 任何流在对象建立的时候会自动打开 任何流不会自动进行关闭 除非它被垃圾收集了 可以使用close 方法对流进行关闭 使用close 方法关闭了流以后 将不能再从其中读出数据或向其中写入数据 2020 3 27 18 文件的读写 对文件的读写是Java中最普通的I O操作 对文件操作的流包括以下几种输入流 FileInputStream FileReader输出流 FileOutputStream FileWriter他们实现了最基本的read和write操作 2020 3 27 19 File类 在进行文件读写操作时 必须知道一些有关文件的信息 File类封装了读取和设置文件属性的方法 2020 3 27 20 File类的构造方法 publicFile StringpathName 创建一个路径名为 pathName 的文件 publicFile Stringparent Stringchild 在 parent 目录下 建立一个名为 child 的文件publicFile Fileparent Stringchild 在 parent 目录下 建立一个名为 child 的文件publicFile URIuri 以 uri 为路径名 创建一个文件 2020 3 27 21 File类中的操作 文件名操作目录操作文件属性操作 2020 3 27 22 File类中的文件名操作 publicStringgetName 得到一个不包含路径的文件名publicStringgetParent 得到文件上一级的目录名publicFilegetParentFile 得到文件对象父路径名publicStringgetPath 返回文件路径名字符串 即路径文件名 publicString list 返回一个字符串数组 为该文件所在目录下的所有文件名列表 2020 3 27 23 File类中的文件名操作 publicbooleanrenameTo FilenewName 重新命名文件publicFilegetCanonicalFile 等价于newFile this getCanonicalPath publicStringgetAbsolutePath 得到一个文件的绝对路径名publicFilegetAbsoluteFile 等价于newFile this getAbsolutePath 2020 3 27 24 文件类中的文件属性测试 publicbooleanexists 测试文件是否存在 publicbooleanisDirectory 测试文件是否为目录 publicbooleanisFile 测试文件是否一般的文件 非目录 publicbooleanisAbsolute 测试文件是否为绝对路径 pubicbooleanisHidden 测试文件是否为隐含文件 publicbooleancanRead 测试文件是否可读 pubilcbooleancanWrite 测试文件是否可写 2020 3 27 25 文件类中的文件信息和工具 publiclonglastModified 返回文件最后一次修改的时间 publiclonglength 返回文件长度 publicbooleandelete 删除该文件 若文件为目录名 该目录必须为空 publicvoiddeleteOnExit 当虚拟机执行结束时 删除该文件或目录 2020 3 27 26 File类中的目录操作 publicbooleanmkdir 创建指定的目录 pubicbooleanmkdirs 创建指定的目录 包含任何不存在的父目录 pubicString list 返回一个字符串数组 包含该文件目录下的所有文件名 publicString list FilenameFilterfilter 返回一个字符串数组 包含该文件目录下满足指定文件过滤器的文件 publicFile listFiles 返回该文件目录下的文件列表 pubicFile listFiles FilenameFilterfilter 返回该文件目录下 满足指定文件过滤器的文件列表 2020 3 27 27 File类中的文件属性设置 publicbooleansetReadOnly 将文件或目录标记为只读属性 publicbooleansetLastModified longtime 设置该文件或目录的最后修改时间 2020 3 27 28 File类中的其他方法 publicintcompareTo Filefile 比较两个文件是否相同 publicbooleanequals Objectobj 判断该文件与指定对象是否表示相同的文件 publicinthashCode 返回文件名的哈希码 2020 3 27 29 文件类举例 importjava io publicclassFileTest publicstaticvoidmain String args if args length 0 for inti 0 i args length i FilefileToCheck newFile args i showInfo fileToCheck 2020 3 27 30 publicstaticvoidshowInfo Filefile if file exists if file isFile System out println isafile System out println Name file getName System out println Parent file getParent System out println ParentFile file getParentFile System out println Path file getPath System out println Readable file canRead 2020 3 27 31 System out println Writable file canWrite System out println Length file length else System out println isadirectory String files file list for inti 0 i files length i System out println child i files i 2020 3 27 32 File roots file listRoots for inti 0 i roots length i System out println root i roots i else System out println file getName notexits 2020 3 27 33 文件输入流的构造方法 FileInputStream的构造方法FileInputStream Filefile FileInputStream FileDescriptorfdObj FileInputStream Stringname FileReaderFileReader Filefile FileReader FileDescriptorfd FileReader StringfileName 2020 3 27 34 文件输出流的构造方法 FileOutputStream的构造方法FileOutputStream Filefile FileOutputStream Filefile booleanappend FileOutputStream FileDescriptorfdObj FileOutputStream Stringname FileOutputStream Stringname booleanappend 2020 3 27 35 文件输出流的构造方法 FileWriter的构造方法FileWriter Filefile FileWriter Filefile booleanappend FileWriter FileDescriptorfdObj FileWriter Stringname FileWriter Stringname booleanappend 2020 3 27 36 对文件进行读写操作举例 importjava io publicclassCopy publicstaticvoidmain String args throwsIOException FileinputFile newFile farrago txt FileoutputFile newFile outagain txt FileReaderin newFileReader inputFile FileWriterout newFileWriter outputFile intc while c in read 1 out write c in close out close 2020 3 27 37 标准I O流 通过控制台完成输入 输出 实现人机交互的流称为标准I O流 java lang System类中对应于标准I O的几个静态变量 System in 标准输入 如键盘 Syetem out 标准输出 如计算机屏幕 System err 标准错误 终端窗口 2020 3 27 38 标准输入System in System in是一个InputStream对象 常与键盘或用户指定的其它输入设备关联 System in常与read 方法连用 获取字节流数据 一次读取一个字节 返回0 255之间的一个整数 如果碰到输入结尾 则返回 1 2020 3 27 39 标准输出System out System out是一个PrintStream对象 常与系统的输出设备关联 如屏幕 或用户指定的其它设备 System out中包含两种类型的输出方法print方法 输出完当前内容后不换行println方法 输出完当前内容后进行换行 2020 3 27 40 System out中的打印方法 2020 3 27 41 标准输入举例 importjava io publicclassEcho publicstaticvoidmain String args throwsIOException BufferedReaderin newBufferedReader newInputStreamReader System in Strings while s in readLine length 0 System out println s 2020 3 27 42 Stream的链接处理 Java中使用一系列的流链接在一起来完成对数据的处理 数据源 FileInputStream BufferedInputStream DataInputStream 程序 数据源 FileInputStream BufferedOutputStream DataOutputStream 程序 2020 3 27 43 流的功能 I O流的链接处理使得流不仅仅能够完成数据读写操作 还对数据进行了大量的处理数据缓冲管道内存读写流的拼接字节和字符转换对象序列化 2020 3 27 44 过滤流 FilterStream 过滤流的基本类为抽象类过滤流实现链接处理的基本类过滤流是基本流的扩展JavaI O中的过滤流的基本类如下FilterInputStreamFilterReaderFilterOutputStreamFilterWriter 2020 3 27 45 过滤流的子类 BufferedStream 缓冲流 DataStream 数据流 LineNumberStreamPushbackStream 2020 3 27 46 缓冲流 BufferedStream 缓冲流是过滤流的子类 缓冲流为其他流对象添加了缓冲功能 JavaI O中的缓冲流构件 BufferedInputStreamBufferedReaderBufferedOutputStreamBufferedWriter 2020 3 27 47 缓冲流的操作过程 使用缓冲输入流时数据先按照块读入缓冲区 然后可以通过访问缓冲区来访问被读入的块使用缓冲输出流时 先把数据输出到缓冲区 直至缓冲区满时 将缓冲区的数据一次性写入 2020 3 27 48 BufferedInputStream BufferedInputStream的构造方法BufferedInputStream InputStreamin 以给定的InputStream对象为基础构造一个BufferedInputStream对象 同时为其分配默认大小的缓冲区BufferedInputStream InputStreamin intsize 以给定的InputStream对象为基础构造一个BufferedInputStream对象 同时为其分配给定大小的缓冲区 2020 3 27 49 BufferedInputStream中的方法 available 返回可以一次性从缓冲区中读取的数据的数量mark intreadlimit 标记InputStream中的当前位置 readLimit参数声明标记失效前 输入流可以读取的字节数 markSupported 判断当前的流是否支持标记 reset 重新设置markskip longn 从InputStream的当前位置开始删除给定位数的数据 2020 3 27 50 BufferedReader的构造方法 BufferedReader Readerin 构造一个以给定的Reader对象为基础的BufferedReader对象 并建立规定默认长度的缓冲区 BufferedReader Readerin intsz 构造一个以给定的Reader对象为基础的BufferedReader对象 并建立规定指定长度的缓冲区 2020 3 27 51 BufferedReader中的方法 mark intreadAheadLimit 标记InputStream中的当前位置 readAheadLimit参数规定当从mark的位置开始往后的有效位置 markSupported 返回当前的InputStream对象中是否支持MarkreadLine 读取当前行的数据reset 重新设置mark位置skip longn 从InputStream的当前位置开始删除给定位数的数据 2020 3 27 52 BufferedOutputStream的构造方法 BufferedOutputStream OutputStreamout 以给定的OutputStream为基础建立BufferedOutputStream对象 并为其规定默认大小的缓冲区 BufferedOutputStream OutputStreamout intsize 以给定的OutputStream为基础建立BufferedOutputStream对象 并为其规定指定大小的缓冲区 2020 3 27 53 BufferedOutputStream中的方法 flush 强制将当前的缓冲区中的内容写入到OutputStream中去write byte b intoff intlen 将给定的数组中从off位置开始的指定数量的数据写入到BufferedOutputStream中去write intb 将给定的数据写入到BufferedOutputStream中去 2020 3 27 54 BufferedWriter的构造方法 BufferedWriter Writerout 以给定的Writer对象为基础建立一个BufferedWriter对象 并为其规定默认大小的缓冲区BufferedWriter Writerout intsz 以给定的Writer对象为基础建立一个BufferedWriter对象 并为其规定指定大小的缓冲区 2020 3 27 55 BufferedWriter中的方法 flush 强制将当前的缓冲区中的内容写入到Writer中去newLine 为BufferedWriter建立一个新行 即向其中插入一个表示新行的字符 write char cbuf intoff intlen 将给定的字符数组中从off位置开始的指定数量的字符写入到当前的BufferedWriter中去write intc 将给定的数据写入到当前的BufferedWriter中write Strings intoff intlen 将给定的字符串中从off位置开始的指定数量的字符写入到当前的BufferedWriter中去 2020 3 27 56 数据流 DataStream 数据流是过滤流的子类数据流完成了简单数据类型的读写功能JavaI O中的数据流构件DataInputStreamDataOutputStream 2020 3 27 57 DataInputStream的构造方法 DataInputStream InputStreamin 以给定的InputStream为基础构造一个DataInputStream对象 2020 3 27 58 DataInputStream中的方法 read byte b 将DataInputStream中的数据读取到给定的数组中 同时返回实际读取的位数read byte b intoff intlen 从DataInputStream中读取最多len个字节的数据 存放到字节数组b中从off开始的位置 readBoolean 从DataInputStream中读取boolean数据readByte 从DataInputStream中读取byte数据readChar 从DataInputStream中读取char类型数据 2020 3 27 59 DataInputStream中的方法 readDouble 从DataInputStream中读取double类型数据readFloat 从DataInputStream中读取float类型数据readFully byte b 从DataInputStream中读取长度为给定数组长度的数据 同时把数据保存到给定的数组中readFully byte b intoff intlen 从DataInputStream中读取长度为给定长度的数据 同时把数据保存到给定的数组中的给定位置上readInt 从DataInputStream中读取int类型数据 2020 3 27 60 DataInputStream中的方法 readLong 从DataInputStream中读取long类型数据readShort 从DataInputStream中读取short类型数据readUnsignedByte 从DataInputStream中读取从0到255之间的数据readUnsignedShort 从DataInputStream中读取从0到65535之间的数据readUTF 从DataInputStream中读取UTF 8编码的字符skipBytes intn 从DataInputStream中删除给定位数的数据 2020 3 27 61 DataOutputStream的构造方法 DataOutputStream OutputStreamout 以给定的OutputStream为基础构造一个DataOutputStream对象 2020 3 27 62 DataOutputStream中的方法 size 返回被写入到DataOutputStream中的数据的位数writeBoolean booleanv 将给定的boolean值写入到DataOutputStream中writeByte intv 将int值的1位字节表示写入到DataOutputStream中 int值必须在0到255之间writeBytes Strings 将给定的字符串以字节方式写入到DataOutputStream中writeChar intv 将给定的int值作为2位的字节写入到DataOutputStream中 2020 3 27 63 DataOutputStream中的方法 writeChars Strings 将给定的字符串写入到DataOutputStream中writeDouble doublev 将给定的double数据写入到DataOutputStream中writeFloat floatv 将给定的float数据写入到DataOutputStream中writeInt intv 将给定的int数据写入到DataOutputStream中 2020 3 27 64 DataOutputStream中的方法 writeLong longv 将给定的long数据写入到DataOutputStream中 writeShort intv 将给定的int值强制转换成为short类型数据同时写入到DataOutputStream中 writeUTF Stringstr 将给定的字符串使用修改过的UTF编码 再写入到DataOutputStream中 2020 3 27 65 DataOutputStream举例 importjava io publicclassDataIODemo publicstaticvoidmain String args throwsIOException DataOutputStreamout newDataOutputStream newFileOutputStream invoice1 txt double prices 19 99 9 99 15 99 3 99 4 99 int units 12 8 13 29 50 String descs JavaT shirt JavaMug DukeJugglingDolls JavaPin JavaKeyChain 2020 3 27 66 for inti 0 i prices length i out writeDouble prices i out writeChar t out writeInt units i out writeChar t out writeChars descs i out writeChar n out close DataInputStreamin newDataInputStream newFileInputStream invoice1 txt doubleprice total 0 0 intunit StringBufferdesc 2020 3 27 67 try while true price in readDouble in readChar unit in readInt in readChar charchr desc newStringBuffer 20 2020 3 27 68 while chr in readChar n desc append chr System out println You veordered unit unitsof desc at price total total unit price catch EOFExceptione System out println ForaTOTALof total in close 2020 3 27 69 CheckedStream CheckedStream是过滤流的子类使用CheckedStream时 可以在输入和输出数据时 记录数据的个数 通过个数来对数据进行完整性校验CheckedStream不在java io包中 它存在于包java util zip包中 CheckedStream中的构件为CheckedInputStreamCheckedOutputStream 2020 3 27 70 CheckedStream举例 importjava util zip importjava io publicclassCheckedIOStreamDemo publicstaticvoidmain String args throwsException Adler32inChecker newAdler32 Adler32outChecker newAdler32 CheckedInputStreamin null CheckedOutputStreamout null 2020 3 27 71 try in newCheckedInputStream newFileInputStream args 0 inChecker out newCheckedOutputStream newFileOutputStream args 1 outChecker catch FileNotFoundExceptione System err println CheckedIODemo e System exit 1 catch IOExceptione System err println CheckedIODemo e System exit 1 2020 3 27 72 intc while c in read 1 out write c System out println inputcheckedsum inChecker getValue System out println outputcheckedsum outChecker getValue in close out close 2020 3 27 73 LineNumberStream LineNumberStream是过滤流的子类LineNumberStream提供了按行读取内容的方法LineNumberStream不提供输出的功能JavaI O中的LineNumberStream构件LineNumberReaderLineNumberInputStream Deprecated 2020 3 27 74 LineNumberReader的构造方法 LineNumberReader Readerin 以给定的Reader对象为基础构造一个LineNumberReader对象 并为其分配默认大小的缓冲区LineNumberReader Readerin intsz 以给定的Reader对象为基础构造一个LineNumberReader对象 并为其分配指定大小的缓冲区 2020 3 27 75 LineNumberReader中的方法 getLineNumber 获取当前行的行号readLine 读取当前的行setLineNumber intlineNumber 设置当前的行号 2020 3 27 76 PushbackStream PushbackStream是过滤流的子类PushbackStream提供了回退的机制 即可以将已经读取的一段内容重新回退到流中 然后再次读取PushbackStream不提供输出的功能JavaI O中的PushbackStream构件PushbackInputStreamPushbackReader 2020 3 27 77 PushbackInputStream中的构造方法 PushbackInputStream InputStreamin 以给定的InputStream为基础构造PushbackInputStream对象 并为其分配默认大小的缓冲区PushbackInputStream InputStreamin intsize 以给定的InputStream为基础构造PushbackInputStream对象 并为其分配指定大小的缓冲区 2020 3 27 78 PushbackInputStream中的方法 unread byte b 将给定的数组中的内容回退到PushbackInputStream中的缓冲区unread byte b intoff intlen 将给定数组中从off位置开始的规定长度的数据回退到PushbackInputStream中的缓冲区中unread intb 将给定的数据回退到PushbackInputStream的缓冲区中 2020 3 27 79 PushbackReader的构造方法 PushbackReader Readerin 以给定的Reader对象为基础构造PushbackReader对象 同时为其分配默认大小的缓冲区PushbackReader Readerin intsize 以给定的Reader对象为基础构造PushbackReader对象 同时为其分配规定大小的缓冲区 2020 3 27 80 PushbackReader中的方法 unread char cbuf 将给定的字符数组中的数据回退到PushbackReader对象的缓冲区中unread char cbuf intoff intlen 将给定的字符数组中的数据从off位置开始 指定长度的字符回退到PushbackReader对象的缓冲区中unread intc 将给定数据回退到PushbackReader对象的缓冲区中 2020 3 27 81 管道流 PipeStream 管道流的作用将一个程序 线程或代码段的输出连接到另一个程序 线程或代码段的输入JavaI O中的管道流构件PipedInputStreamPipedOutputStreamPipedReaderPipedWriter 2020 3 27 82 管道流的操作流程 使用管道流时要求管道的输入流与管道的输出流必须事先连接好管道输入流将数据从管道中读出管道输出流将数据送入管道 2020 3 27 83 PipedInputStream的构造方法 PipedInputStream 构造一个空的PipedInputStream对象PipedInputStream PipedOutputStreamsrc 构造一个和给定的PipedOutputStream对象相关联的PipedInputStream对象 2020 3 27 84 PipedInputStream中的方法 connect PipedOutputStreamsrc 将PipedInputStream和给定的PipedOutputStream相关联 2020 3 27 85 PipedReader的构造方法 PipedReader 构造一个空的PipedReader对象PipedReader PipedWritersrc 构造一个与规定的PipedWriter对象相关联的PipedReader对象 2020 3 27 86 PipedReader中的方法 connect PipedWritersrc 将当前的PipedReader对象和给定的PipedWriter对象相关联 2020 3 27 87 PipedOutputStream的构造方法 PipedOutputStream 构造一个空的PipedOutputStream对象PipedOutputStream PipedInputStreamsnk 构造一个与给定的PipedInputStream相关联的PipedOutputStream对象 2020 3 27 88 PipedOutputStream中的方法 connect PipedInputStreamsnk 将当前的PipedOutputStream与给定的PipedInputStream对象相关联 2020 3 27 89 PipedWriter中的构造方法 PipedWriter 构造一个空的PipedWriter对象PipedWriter PipedReadersnk 构造一个与给定的PipedReader对象相关联的PipedWriter对象 2020 3 27 90 PipedWriter中的方法 connect PipedReadersnk 将当前的PipedWriter对象和给定的PipedReader对象相关联 2020 3 27 91 管道流使用举例 importjava io publicclassRhymingWords publicstaticvoidmain String args throwsIOException DataInputStreamwords newDataInputStream newFileInputStream words txt dothereversingandsortingInputStreamrhymedWords reverse sort reverse words writenewlisttostandardoutDataInputStreamin newDataInputStream rhymedWords 2020 3 27 92 Stringinput while input in readLine null System out println input in close publicstaticInputStreamreverse InputStreamsource throwsIOException DataInputStreamin newDataInputStream source PipedOutputStreampipeOut newPipedOutputStream PipedInputStreampipeIn newPipedInputStream pipeOut 2020 3 27 93 PrintStreamout newPrintStream pipeOut newReverseThread out in start returnpipeIn publicstaticInputStreamsort InputStreamsource throwsIOException DataInputStreamin newDataInputStream source 2020 3 27 94 PipedOutputStreampipeOut newPipedOutputStream PipedInputStreampipeIn newPipedInputStream pipeOut PrintStreamout newPrintStream pipeOut newSortThread out in start returnpipeIn 2020 3 27 95 classReverseThreadextendsThread privatePrintStreamout null privateDataInputStreamin null publicReverseThread PrintStreamout DataInputStreamin this out out this in in 2020 3 27 96 publicvoidrun if out null 2020 3 27 97 privateStringreverseIt Stringsource inti len source length StringBufferdest newStringBuffer len for i len 1 i 0 i dest append source charAt i returndest toString 2020 3 27 98 classSortThreadextendsThread privatePrintStreamout null privateDataInputStreamin null publicSortThread PrintStreamout DataInputStreamin this out out this in in publicvoidrun intMAXWORDS 50 2020 3 27 99 if out null 2020 3 27 100 catch IOExceptione System err println SortThreadrun e privatestaticvoidquicksort String a intlo0 inthi0 intlo lo0 inthi hi0 if lo hi return 2020 3 27 101 Stringmid a lo hi 2 while lo0 hi if lo hi StringT a lo a lo a hi a hi T lo hi 2020 3 27 102 if hi lo intT hi hi lo lo T quicksort a lo0 lo quicksort a lo lo0 lo 1 lo hi0 2020 3 27 103 SequenceInputStream SequenceInputStream的作用是将两个或两个以上的InputStream转换成一个InputStream进行处理 2020 3 27 104 SequenceInputStream的构造方法 SequenceInputStream Enumeratione 以给定的多个InputStream对象为基础构造SequenceInputStream对象 其中 给定的Enumeration对象中保存的内容必须是各种类型的InputStream对象SequenceInputStream InputStreams1 InputStreams2 以给定的两个InputStream对象为基础构造SequenceInputStream 2020 3 27 105 SequenceInputStream举例 importjava io publicclassConcatenate publicstaticvoidmain String args throwsIOException ListOfFilesmylist newListOfFiles args SequenceInputStreams newSequenceInputStream mylist intc while c s read 1 System out write c s close 2020 3 27 106 classListOfFilesimplementsEnumeration privateString listOfFiles privateintcurrent 0 publicListOfFiles String listOfFiles this listOfFiles listOfFiles publicbooleanhasMoreElements if current listOfFiles length returntrue elsereturnfalse 2020 3 27 107 publicObjectnextElement InputStreamin null if hasMoreElements thrownewNoSuchElementException Nomorefiles else StringnextElement listOfFiles current current try in newFileInputStream nextElement 2020 3 27 108 catch FileNotFoundExceptione System err println ListOfFiles Can topen nextElement returnin 2020 3 27 109 在内存中读写的流 在内存中读写的流指从内存中读取内容或向内存中写入内容的流 在内存中读写的流包含以下几种 CharArrayReaderCharArrayWriterByteArrayInputStreamByteArrayOutputStreamStringReaderStringWriterStringBufferInputStream Deprecated 2020 3 27 11
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025合同解除协议书范例
- 2025企业经营担保借款合同 担保借款合同范本
- 2025年智能设备租赁合同样本
- 2025年版:知识产权许可合同范本
- 2025餐饮行业劳动合同书示范文本
- 2025年发电厂电气高压试验专业题库及答案
- 群监网员考试题库及答案
- 2025中小企业融资贷款合同范本
- 2025年企业并购合同模板
- 2025消防法考试题库及参考答案
- 第1课 假期有收获 第1课时(课件)2025-2026学年道德与法治二年级上册统编版
- 《人为因素与航空法规》课件(共九章)
- (正式版)HGT 20593-2024 钢制化工设备焊接与检验工程技术规范
- GB/T 31586.1-2015防护涂料体系对钢结构的防腐蚀保护涂层附着力/内聚力(破坏强度)的评定和验收准则第1部分:拉开法试验
- 安全文明施工措施费使用计划表完整优秀版
- 免疫学(全套课件)
- 胸部检查(二)肺与胸膜检查
- 高压燃气管线施工安全生产措施
- 医院临床科主任考核测评表
- 大国工匠精神PPT课件
- 中交二公局大西铁路大荔特大桥项目部拌合站管理制度汇编
评论
0/150
提交评论