Io stream summary 2

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.