Working mechanism of Java I / O's

  Today, unzip the file and writing input and output streams, disgusted, a man lost in the maze of people like you, wild guesses. A typical mistake is what I read from the FileInputStream into a CharStream, file and content, but is empty read out, in the end is what causes it? debug several times, this has been a problem, suspect may be character encoding issues, a variety of settings, but they are not. Then suddenly remembered their own local file FileInputStream test is used, then calm down comparison found himself called to avoid memory leaks, call fis.close () function, is probably the reason I put the file input stream to shut down .

  io bias underlying source code looks should not look good, but the classic io java abstract model, understand this, it is sufficient to meet the program io operate. It must first clear the Stream refers to the stream of bytes, only to become a character stream, before taking into account the problem of encoding and decoding.

  Then taste fis.read (buf) What does it mean? File is correct change? buf is a container it? The occupation also take into account the size of the object in memory, the bit-depth

Guess you like

Origin www.cnblogs.com/Robin008/p/11415773.html