Ewan Borland wrote:
> I've implemented a loader for a Java3D app I've got but it's very important
> for me to get some kind of progress monitor. Bearing in mind the Loader
> interface doesn't support such I opted for the approach of using a
I think a better way to do this is re-organise how your loader obtains
the stream. For example, the way this is most often performed is to have
the stream send stuff to a notifier (Swing has a
ProgressMonitorInputStream for this purpose).
Your loader code, when it has to load something, can ask a factory for
the input stream. So something like this:
public Scene load(URL url) {
URLConnection conn = url.openConnection();
InputStream is = conn.getInputStream();
InputStream source = MyStreamFactory.getProgressStream(is);
// do stuff with the source stream
}
This way you can separate the loader code from the stream handling.
Of course, you can always implement the loader so that all load()
methods except the one that takes a pre-built stream is ignored. That
way you can pass it a custom stream that does all the progress
notification yourself.
--
Justin Couch http://www.vlc.com.au/~justin/
Freelance Java Consultant http://www.yumetech.com/
Author, Java 3D FAQ Maintainer http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
- Greg Bear, Slant
-------------------------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".