Re: How to write Array of Object to a file?
- From: Lew <lew@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 08 May 2007 08:10:21 -0400
Robert Larsen wrote:
DL wrote:what is the best way to do this? any suggestions?
That depends on a lot of things. An XML file i very easily read by
humans and portable but often not very scalable. A database is very fast
and scalable. A binary file can be easy to work with (or very very hard).
What would be the typical usage ? And how many records would the file hold ?
There are gazillion ways to emit data. The simplest is to open a file for writing, say in a variable 'wr' -
import java.io.PrintWriter;
...
PrintWriter wr = new PrintWriter( someFileName );
...
wr.println( foo.getProperty().toString() );
Of course, 'toString()' in most cases will not give you what you want, but it's a start.
Really you should just read the Javadocs on the java.io package, and the tutorial:
<http://java.sun.com/docs/books/tutorial/essential/io/index.html>
--
Lew
.
- References:
- How to write Array of Object to a file?
- From: DL
- Re: How to write Array of Object to a file?
- From: DL
- Re: How to write Array of Object to a file?
- From: Lew
- Re: How to write Array of Object to a file?
- From: DL
- Re: How to write Array of Object to a file?
- From: Robert Larsen
- How to write Array of Object to a file?
- Prev by Date: Re: How to write Array of Object to a file?
- Next by Date: Re: Class destructors
- Previous by thread: Re: How to write Array of Object to a file?
- Index(es):
Relevant Pages
|
|