Results 1 to 4 of 4
Thread: Right use of file reading ?
- 08-27-2008, 06:25 PM #1
Member
- Join Date
- Jul 2008
- Posts
- 67
- Rep Power
- 0
Right use of file reading ?
Java Code:FileInputStream in = new FileInputStream("C:\\andmed.txt"); final int BUFFER_SIZE = 8; int off = 0; int actualBytesRead = 0; byte[] buffer = new byte[BUFFER_SIZE]; while ((actualBytesRead = in.read(buffer, 0, BUFFER_SIZE)) != -1) { off += actualBytesRead -1; System.out.println(Arrays.toString(buffer)); }
- 08-27-2008, 06:36 PM #2
What are you trying to do?
What kind of data is in the andmed.txt file? character?
What is being printed? Is it what you want?
- 08-27-2008, 07:39 PM #3
Member
- Join Date
- Jul 2008
- Posts
- 67
- Rep Power
- 0
Reading binary and text files. I mostly used for reading files like this
But i though this is waste of resources, reading byte by byteJava Code:while ((byte = in.read()) != -1) { System.out.println(byte); }
- 08-27-2008, 08:16 PM #4
Similar Threads
-
Reading a properties file
By peiceonly in forum New To JavaReplies: 7Last Post: 05-06-2010, 05:17 PM -
Reading a file
By mew in forum New To JavaReplies: 2Last Post: 12-30-2007, 12:23 PM -
Reading text file
By Lennon-Guru in forum New To JavaReplies: 1Last Post: 12-15-2007, 11:38 PM -
Reading a file for use
By peachyco in forum New To JavaReplies: 2Last Post: 11-27-2007, 03:49 AM -
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