No, in your example there is no need for a DataInputStream, because you finally get a BufferedReader for reading data.
What's the point:
FileInputStream fstream = new FileInputStream ("file1.txt"); BufferedInputStream br = new BufferedInputStream(fstream); DataInputStream dis = new DataInputStream(br);
This will usually go hand in hand if you created file1.txt using:
DataOutputStream dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("file1.txt")));
Edit:
Why is it allowed by Java, if that doesn't make sense? Because it is a Decorator , and this is one of the drawbacks of the Decorator template.
source share