Current Forum: Homework 5 - Parts 1 and 2 |
Date: Thu Nov 15 2001 3:02 pm |
Author: Scherer, Sebastian <basti@cmu.edu> |
Subject: Re: toString() in WebIndex.java |
|
|
Hi, From a oo-point of view it is much better to use ObjectOutputStream/ObjectInputStream to write out the index. It is maybe two lines but nicer.(As long as you every object is implemented as serializable)
For example:
ObjectOutputStream p = new ObjectOutputStream(stream); p.writeObject(trieRoot);
I think there is a minor mistake in the implementation of WebCrawler. The Stream should be flushed and closed at the end of the use, but it is not done. It is bad style to do this in a subroutine, because it is not known if the Stream should be closed or is used further.
Sebastian |
|