Console was added by Java SE 6.
The java.io package also contains two deprecated classes that are not shown in the
preceding table: LineNumberInputStream and StringBufferInputStream. These classes
should not be used for new code.
The following interfaces are defined by java.io:
As you can see, there are many classes and interfaces in the java.io package. These include
byte and character streams, and object serialization (the storage and retrieval of objects). This
chapter examines several of the most commonly used I/O components. The new Console class
is also examined. We begin our discussion with one of the most distinctive I/O classes: File.
Although most of the classes defined by java.io operate on streams, the File class does not.
It deals directly with files and the file system. That is, the File class does not specify how
information is retrieved from or stored in files; it describes the properties of a file itself. A
File object is used to obtain or manipulate the information associated with a disk file, such
as the permissions, time, date, and directory path, and to navigate subdirectory hierarchies.
Files are a primary source and destination for data within many programs. Although
there are severe restrictions on their use within applets for security reasons, files are still a
central resource for storing persistent and shared information. A directory in Java is treated
simply as a File with one additional property--a list of filenames that can be examined by
the list( ) method.
The following constructors can be used to create File objects:
File(String directoryPath, String filename)
File(File dirObj, String filename)
Search WWH :