Results 1 to 9 of 9
Thread: Files
- 07-18-2011, 06:14 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 24
- Rep Power
- 0
- 07-18-2011, 06:17 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 07-18-2011, 06:18 PM #3
Is it a sequential file with variable length records or are the records all the same length?I need to retrieve the records from input file using the line numbers which are in array.
For the normal, sequential text file, you will have to read the records in order starting at the first one.
If the records are fixed length you can use the RandomAccessFile class to read them as required vs sequentially.
- 07-18-2011, 06:39 PM #4
Member
- Join Date
- Jun 2011
- Posts
- 24
- Rep Power
- 0
Thanks for your reply. My input file records are of same length and separated by tabs. I have random line number in an array. Now I need to retrieve records from the input file using random line number. Can you give an example or logic that would help me a lot?
- 07-18-2011, 06:48 PM #5
There are code samples here. Use Search or Google for samples of RandomAccessClass.
The tabs are irrelevant. The contents of any record is irrelevant. Each record must have exactly the same number of characters.My input file records are of same length and separated by tabs
Say the records are 10 characters long, the first record is at location 0, 2nd at 10, third at 20, 4th at 30 etc
- 07-18-2011, 07:38 PM #6
Member
- Join Date
- Jun 2011
- Posts
- 24
- Rep Power
- 0
Hello,
I am sorry. Their was a mistake in my question. Here is the exact question what I mean. I need to retrieve the lines(these are separated by tabs) from the input file using the line numbers(these are in random) which are stored in array.
- 07-18-2011, 07:40 PM #7
Then you will need to read the file starting at byte 0 and count the lines as you go.I need to retrieve the lines(these are separated by tabs)
- 07-18-2011, 09:06 PM #8
Member
- Join Date
- Jun 2011
- Posts
- 24
- Rep Power
- 0
This helped me. In files, we have readLine() class to read next line of the file pointer. Like this,Is their any class to read before line of the file pointer?
- 07-18-2011, 09:21 PM #9
Similar Threads
-
Java webstart having problem with multiple jar files and resource files
By rjalori in forum AWT / SwingReplies: 2Last Post: 06-11-2011, 01:54 PM -
Creating Jar Files with functioning input files
By appleLove in forum NetBeansReplies: 1Last Post: 04-10-2011, 10:37 PM -
Convert avi, mpeg, wmv media files to .flv files in java code
By vinay1497 in forum New To JavaReplies: 8Last Post: 07-30-2010, 05:47 PM -
Behaving text files like binary files
By Farzaneh in forum New To JavaReplies: 2Last Post: 08-27-2008, 03:20 PM -
how to convert mpeg files to .wav files
By christina in forum New To JavaReplies: 1Last Post: 08-06-2007, 04:14 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks