Java text I/O and binary I/O

Source: Internet
Author: User
Tags throw exception

1, the computer does not distinguish between binary files and text files, all files are stored in binary files

2, write the characters, the Java Virtual machine will be Unicode into the coding, read the reverse, Windows, the default encoding is ASCII

? 3, for text editor or text output program to create files, should be read with text input, for the Java binary output file should be used binary input to read

4, so the Java binary output file can be run on any machine with a Java VM, because the binary file and the host encoding scheme is irrelevant

5. txt is a text file, DAT is a binary file

? 6, Writebytes () for ASCII strings, with Writechar () quasi-yes

7, UTF-8 memory ASCII code as long as a byte, very advantageous

? 8, the IO class activates all methods to throw exception java.io.IOException, so you must declare the thrown exception in the method or put the code in the Try-catch block

Java text I/O and binary I/O

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.