William Jefferson wrote:I've been steadily learning Java with the goal of replacing a legacy Visual Basic app with java. Now I'm to the good part - File I-O. But my historical VB files have integers stored as integer field. So far, everything I've read about file input in Java makes me think all data is stored as character strings, usually separated by a delimiter.
First, is that true? Care to elaborate for newbie?
See above. Yes, either by:Second, is there any way to read an old style interger field from a file in Java?
I assume I can use VB to convert this old data into a java readable format. These are what I have always called "flat" files. I read the file once and build an array index based on customer name, display these names and allow the user to jump from customer to customer. There are multiple data records per customer, but only one customer name record per customer. In VB I had a fixed length record and could seek on record number. Am I still going to be able to do this in java? Again, care to elaborate for a newbie?
Steve
William Jefferson wrote:
Thanks for the reply Steve. At this point my ignorance is overwhelming. Guess my next step is to write some integers to a file and then look at them. When I read about DataInputStream, it still seems as though the actual data storage on the hard drive is going to be numbers stored 1 number per byte as if they were characters in a text field.
Because it says you can have commas in the number.
You can't store commas in numbers the way the old timey file systems were written. The old systems were hot on space savings and could store a 5 digit integer into two bytes on the hard drive.
I can't convert my old files until I'm sure of how data is stored in Java. So I guess I'll play with file i-o for a while.
thanks again
other comments still welcome ;-)
Steve
William Jefferson wrote:
Because it says you can have commas in the number.
Steve Luke wrote:
Really? I looked through the API for DataInputStream (text search) and found no reference to commas. Can you point to where you saw that?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |