• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

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.
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic