A stream can only operate on data.
File class
It is used to encapsulate files or folders into objects.
Convenient file and folder operations
The file object can be passed as a parameter to the stream constructor.
You can encapsulate existing and existing files or folders into objects.
File a = new file(a.txt ");
Common File methods:
1. Create
Boolean creatnewfile (); atomic
Creates a new empty file specified by the abstract path.
Boolean mkdir (): Create a folder.
Boolean mkdirs () to create a multi-level folder
2. Delete
Boolean Delete (); if the object is being deleted, false is returned.
Void deleteonexit (); Delete the specified file when the program exits
3. Judgment
Boolean exists (): whether the file exists
Iffile ()
Isdirectory ()
Ifhidden ();
Isabsolutepath ();
4. Obtain information
Getname ()
Getpath ();
Getparent (); this method returns the parent directory in the absolute path. If the relative path is obtained, null is returned.
If there is a directory in the relative path, the directory returns the result.
Getabsolutepath ()
Lastmodidied ();
Length ();
When determining whether a file object is a file or the purpose is to determine whether the encapsulated content of the file object exists.
Exists is used to determine, (false is returned because the file or folder does not exist)
Properties is a subclass of hashtable.
That is to say, it has the characteristics of the map set, and the key-value pairs stored in it are strings.
Is a collection container that combines Io counts in a collection.
The features of this object can be used in key-value pairs.
When loading data, the data must have a fixed format, key = value.
Configuration File XML,
Dom4j dom for Java
Print stream:
The stream provides a printing method to print all data types as they are.
Character print stream:
Printwriter
The constructor can accept the parameter type.
1 file, Object File
2 string path, string
3-byte output stream. Outputstream
4-character output stream, writer
Byte promised stream:
Printstream
Acceptable parameter types of Constructors
1 file object file
2 string path, string
3-byte output stream outputstream
Sequenceinputstream
Merge multiple streams
Vectoring contains enumeration.
Split the file and use the counter Method
Io stream summary 2