Java – data input stream required
•
Java
What's the difference?
FileInputStream fstream = new FileInputStream ("file1.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
and
FileInputStream fstream = new FileInputStream ("file1.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in));
Do we really need a datainputstream?
Solution
The important thing about the object passed to the inputstreamreader () constructor is that it will be the object that carries the weight of any synchronization hold If you don't want your FileInputStream to be blocked by multiple calls, the second option is a viable method See the source of reader
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码