-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

yoursoft,

yoursoft wrote:
> Dear Developers,
> 
> The first version is my class is available.
> It is a little performance "tweak", because this read from disk only,
> when original template is changed, and make a cached compressed copy of it.

Just to recap... this thing normalizes spaces in a template, right?

> With compressed input, the memory use is lower, velocity variables
> insertion is faster and bandwidth usage is also lower.

Can you quantify these claims? For instance, how much less memory (and
bandwidth) is really used given a relatively standard template? How can
Velocity variable insertion be faster?

It also looks like you implemented many methods (such as init,
getResourceStream, isSourceModified, and getLastModified) that might be
better implemented elsewhere. For instance, since your implementation of
ResourceLoader appears to be file-based, why not extend
FileResourceLoader and then just modify the behavior of
getResourceStream like this:

public InputStream getResourceStream(String templateName)
    throws ResourceNotFoundException
{
     InputStream in = super.getResourceStream(templateName);

     // now perform your filtering
}

This would make a much cleaner class, IMO. It would also make this into
more of a filter, which makes more sense me, personally. Instead of
essentially copying the file and then reading /that/ into memory, why
not just filter the input stream on the fly?

You could also write your class such that instead of extending a single
class (such as FileResourceLoader), you could wrap /any/ type of
resource loader, and pass the source loader as an argument to a
constructor. Your no-arg constructor could simply use a
FileResourceLoader as the default.

Then, all your methods would be delegates to the "real" loader except
for getResourceStream, which would perform the filtering.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF/9429CaO5/Lv0PARAghtAKDCUXKn8A67aIE3hkqGtU0NBGutVACgoqyL
0cwDBrMNLoX8Togr/dPJ6LE=
=s2ms
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to