The tenth week Lessons Learned
Others
2019-10-29 23:42:51
views: null
The tenth week Lessons Learned
First, the RandomAccessFile
class
Uses: File
class file itself is only performed for the operation, and if you want to manipulate the contents of a file, you can use the RandomAccessFile
class, which belongs to the class of random read, random read data file in a specified location.
RandomAccessFile
Common methods of operation class:
Note: If the rw
fashion statement RandomAccessFile
when the object to be written to the file does not exist, the system will automatically be created.
Second, the byte stream and character stream
Flow: all data is transmitted in a streaming manner or in a program stored in the program data to be used when necessary to read the input data stream, and when the program needs to be saved in some data, it is necessary to use the output stream carry out. As shown below:
Protocol: In Java
the IO
operating step is also appropriate to operate the files as an example, the main procedure is as follows:
(1) using the File
class to open a file.
(2) specify the location of the output byte stream, or by subclassing the character stream.
(3) read / write operation.
(4) closes the input / output.
Byte stream
Origin www.cnblogs.com/lcbxhda/p/11762181.html