1 / 63
文档名称:

Java程序设计英文版课件:ch18 IO (InputOutput).ppt

格式:ppt   大小:788KB   页数:63页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Java程序设计英文版课件:ch18 IO (InputOutput).ppt

上传人:窝窝爱蛋蛋 2021/12/7 文件大小:788 KB

下载得到文件列表

Java程序设计英文版课件:ch18 IO (InputOutput).ppt

相关文档

文档介绍

文档介绍:*
Chapter 18
I/O (Input/Output)
*
Introduction to I/O
Creating a good input/output (I/O) system is one of the more difficult tasks for a language designer. This is evidenced by the number of different approaches.
The challenge of I/O:
Different sources
Different sinks
Files, the console, network connections
Sequential, random-access, buffered, binary, character, by lines, by words
*
Introduction to I/O
Class File
I/O Stream
Input Streams/ Output Streams
Node Streams/ Processing Streams
File Streams/ Buffer Streams
Print Streams
Data Streams /Object Streams
RandomAccessFile
Compression
XML
*
Introduction to I/O
Sally
Black
Tom
Blue
Judy
Green
Iris
Orange
Randy
Red
Judy
Green
J u d y String
01001010 Byte
1 Bit
line
File
0
1
2
3
4
……
n-1
n
A file containing n Bytes
*
Introduction to I/O
Stream in Java I/O
In Java, the input and output of data are operated by “Stream”.
There are a lot of “Stream” in Java for different data types.
*
Class File
Introduction

represent either the name of a particular file or the names of a set of files in a directory.
Constructor summary of Class File
public File (String pathname)
  Creates a new File instance by converting the given pathname string into an abstract pathname.
public File(String parent, String child)
Creates a new File instance from a parent pathname string and a child pathname string.
*
Class File
Methods summary of class File
public boolean canRead()
public boolean canWrite()
public boolean exists()
public boolean isDirectory()
public boolean isFile()
public boolean isHidden()
public long lastModified()
public long length()
public String getName()
public String getPath()
*
Class File
Methods summary of class File
public boolean createNewFile() throws IOException
Atomically creates a new, empty file named by this abstract pathname if and only if a file with this name doe