• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Reading different file extensions

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I was just wondering what all file extensions that you could read in java. I just bought a new organizer and it can import/export different files such as the to do list/schedule/phone book, but it's only for back up, I wanted to see if I could write a program to open the file and interpret the file so I could read it on my computer and maybe modify it. The files are saved as .csv. Is this possible, can i just read the file like I would a regular text file?? If not how would you do this?? Thank you for your time and GOD Bless.

Matthew Middleton
 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can read any file in Java, you just need to know how to read it, i.e. how is the data stored in the file. File extensions do nothing magical - they just give a hint to whatever program you are using as to how to read the data. For example, if you have MS Word installed, then Windows associates .doc to Word and uses it to open that type of file.

As long as your program knows what format the data is in, then the extension can be anything. You could have files that store ascii text and use a .foobar extension. The point is - using Java, you can read any type of file; Your program just needs to know what format it's in to do anything useful, like displaying the data in a gui.

Since a .csv is normally just a comma-delimited ascii text file, then you can simply use a java.io.BufferedReader or some other character-based Reader.
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic