Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 7

File I/O & Collection

Framework
[12]
What is the role of file in java? [4M]
persistent
Files are still a central resource for storing
and shared information.
pathnames
Java File class represents the files and directory
in an abstract manner.
directories,
File class is used for creation of files and
file searching, file deletion, etc.
retrieved
File class does
from or not specify
stored in howit information
files; describes is
the
properties of a file itself.
theA information
File object is used to obtain or manipulate
associated with a disk file, such
as the permissions, time, date, and directory
path, and to navigate subdirectory hierarchies.
 There
appletsare severe reasons.
restrictions on their use within
for security
File [4M]
File objects:
 File(String directoryPath)
 File(String directoryPath, String filename)
 File(File obj, String filename)
 Here, directoryPath
filename is the name isof
the path
the file, name
and of is
obj thea file,
File
object that specifies a directory.
File Class [4M]
public String getName()
 public String getPath()
 public String getAbsolutePath()
 public boolean canRead()
 public boolean canWrite()
 public boolean exists()
 public boolean isDirectory()
 public boolean isFile()
 public boolean createNewFile()
 public long length()
 public boolean delete()
 public String[] list()
 public boolean mkdir()
 public boolean setReadOnly()
Stream [2M]
stream
A stream
is is a sequence
composed of bytes. of data.
It's Ina Java
called a
stream
because it's like a stream of water that continues
to flow.


are attached with console.
1) System.out: standard output stream
2) System.in: standard input stream
 3) System.err: standard error stream

You might also like