Results 1 to 3 of 3
Thread: File Reading Explanation
- 04-03-2009, 02:17 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
File Reading Explanation
Hello Everyone,
i'm having problems understanding the following section of code:
would anybody be able to explain this to me please?Java Code:int returnVal = fc.showOpenDialog(FileChooser.this); //...then open the file chooser box. if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); //Get the file selected by the user. FileInputStream fis = null; BufferedInputStream bis = null; DataInputStream dis = null; try { fis = new FileInputStream(file); bis = new BufferedInputStream(fis); dis = new DataInputStream(bis);
So far i've got that it reads the file line by line in the form of DataInputStream. But why are the FileInputStream and BufferedInputStream needed?
- 04-03-2009, 04:29 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
First of all, do you know the difference of the following.
- FileInputStream
- BufferedInputStream
- DataInputStream
Just read about those things first of all, then you can find the solution. Read carefully about the usage of each.
- 04-03-2009, 05:45 PM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
That's really nice. So what's the point you mess-up with, if you have any on that?
Similar Threads
-
Reading a doc file
By thehero in forum Advanced JavaReplies: 0Last Post: 03-15-2009, 06:48 AM -
Help for reading a doc file
By thehero in forum New To JavaReplies: 1Last Post: 02-24-2009, 06:44 AM -
Right use of file reading ?
By jurka in forum New To JavaReplies: 3Last Post: 08-27-2008, 08:16 PM -
need a little explanation
By cew27 in forum New To JavaReplies: 7Last Post: 12-13-2007, 11:39 PM -
Reading from a file
By leebee in forum New To JavaReplies: 1Last Post: 07-23-2007, 12:02 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks