aspose file tools*
The moose likes Beginning Java and the fly likes Can someone please tell me how to store a table using file handling only Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can someone please tell me how to store a table using file handling only" Watch "Can someone please tell me how to store a table using file handling only" New topic
Author

Can someone please tell me how to store a table using file handling only

Aayush Goel
Greenhorn

Joined: Feb 07, 2011
Posts: 3
Can someone please tell me how to store a table using file handling only
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4174
    
  21

Hi Aayush,

Welcome to the CodeRanch!

I would love to help you with your problem, but I am not really sure what you are asking. Can you be more specific? For example what exactly is a 'table' and what do you mean by 'store' it?


Steve
Aayush Goel
Greenhorn

Joined: Feb 07, 2011
Posts: 3
The table is a simple data table like a product's name , its weight, colour etc like in a data base and i would like to 'store ' it in a simple .dat file on the hard disk.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
You would have to create a format for it, and write that format to the file. Try to avoid the .dat extension, otherwise Windows will think it is a system file.
You might write
Vacuum Cleaner|3.2kg|Red|Can be used as secret weapon
. . . or something similar in each line. The "secret weapon" bit is of course only applicable to Graham Greene fans
Aayush Goel
Greenhorn

Joined: Feb 07, 2011
Posts: 3
Thanks, that exactly hit the mark.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
You're welcome
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

If you use a | to split you data make sure that the input doesn't contain that character.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

And when using | to split, remember that it's a meta character in regular expressions.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can someone please tell me how to store a table using file handling only