Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving a Hashtable contents to a file  RSS feed

 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I am trying to make a method which will take input as a Hashtable and write all its contents that is key-value pairs in to a file (may be comma seperated or any other).

please help me to develop this code.

i will be very happy also if anyone dont directly give the code but will give directions about how to do that
 
Dirk Schumacher
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Strings as Keys and Values it is easily to use
a properties file:

java.util.Properties

It already provides methods to store and read a Hashtable<String,String> via Streams.

If you are storing any Objects you might want to make them java.io.Serializable and learn how to use serialization.

I hope it helped.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!