Let's write a few reviews of IO. Let's review IO.
The opening report is completed in the morning. In the afternoon, I made 90 questions about javaSE. In the evening, I reviewed the Jdbc connection section. Now let's review several IO packaging classes.ObjectInputStream/Obje
channel. 1. Path, paths, and files core API Java provides a limited file class, he can not take advantage of the characteristics of a particular filesystem, the performance of the method provided by file is not high, and most of its methods fail only to return failure, do not provide exception information. Nio.2 to compensate for this shortcoming, the path interface is introduced and the Files\paths tool class is provided. 2. Filevisitor traversing files and directories 3, watchservice monitori
are still sequential, meaning you can't passSetlinenumber () to implement a skip read of the streamStreamtokenizer can recognize identifiers, numbers, quoted strings, and various annotation types. You can also specify what characters are interpreted as spaces, the start and end of comments, and so on. All functions can be configured before Streamtokenizer begins parsing.StringReader can convert the original string to Reader:reader Reader = new StringReader ("Input string ...");StringWriter can
Java Programming IO operation is essential, long time not to play Io, review, write a few small programs, record, easy to access and learn.1. Give an array of integers, write them to a file, read them from the file, and print in reverse order of integer size. Packagecom.io.test;ImportJava.io.BufferedReader;ImportJava.io.File;ImportJava.io.FileInputStream;ImportJa
special needs: Pushbackinputstream, Pushbackreader, Linenumberinputstream, LineNumberReaderThe general guidelines for deciding which class to use and its construction process are as follows (regardless of special needs):First, consider what the most primitive data format is: Principle FourThe second is the input or output: Principle fiveThird, do you need to convert the flow: Principle Six 1thWhat is the source of data (whereabouts): Principle OneFive, whether to buffer: principle Three (Specia
PackageCom.zyw.file;ImportJava.io.*;/*** Created by Zyw on 2016/3/10.*/ Public classFileTest2 { Public Static voidMain (String args[]) {File file=NewFile ("G:", "Work.txt"); FileOutputStream Fos=NULL;DataOutputStream dos=NULL;Try{fos=Newfileoutputstream (file); DOS=NewDataOutputStream (FOS); Try{Dos.writeutf ("Sinking boat side thousand sails, the disease tree before the million wood spring"); } Catch(IOException e) {e.printstacktrace (); } }Catch(FileNotFoundException e) {e.printstacktra
Java IO principleIO streams are used to process data transfer between devicesInput: Read external data (disk, etc storage device) to program ()(In memory)Output: Output program (memory) data to a storage device such as diskJava IO principleIO streams are used to process data transfer between devicesInput: Read external data (disk, etc storage device) to program ()(In memory)Output: Output program (memory) d
: Stream bytes into character streams because the explicit source is Reader, which makes it easier to manipulate text data. So, to convert an existing byte stream into a character stream. Use byte-to-character object InputStreamReader ISR = InputStreamReader (system.in); FileWriter FW = new FileWriter ("B.txt"); Need to be efficient: bufferedreader br = new BufferedReader (new InputStreamReader (System.int)); Requirement 3: Display a text file data on the console1.
Buffers and buffer1. The role of buffersJava.nio.ByteBufferJava.nio.CharBufferJava.nio.ShortBufferJava.nio.IntBufferJava.nio.LongBufferJava.nio.FloatBufferJava.nio.DoubleBufferPosition,limit,capacity2. How the Buffer worksIi. Channels (channel)1. The role of the channel2. Two-way operation of the channel to read and writeFileChannel ()Memory mapping: Mappedbytebuffer reads the content fastestThree Memory mapping modesThird, file lock FilelockThe function and basic operation of file lockFour, Cha
#region read the text of large files using StreamReader using (StreamReader sr = new string txt = null while (txt = Sr. ReadLine ())! = null ) { this . TextBox2.Text + = Txt+"
\r\n
; }} #endregion At first, I tried to solve the missing text of each line read "\ r \ n", so I used another method #regionA way to trouble//using (StreamReader sr = new StreamReader (OFD. FileName, Encoding.default))//{ //char[]
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.