Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave,
Dave Newton wrote:
--- Laurie Harper <[EMAIL PROTECTED]> wrote:
URL res = Thread.currentThread()
.getContextClassLoader()
.getResource(pathToConfigurationFile);
// Save the properties
OutputStream out = new FileOutputStream(res);
properties.store(out, "");
Ooo, I didn't know that.
Hopefully I'll never want to use it, but still really
good to know! :)
I'm not sure where this will work. FileOutputStream doesn't accept a URL
as a constructor argument. I think it's something more involved like:
URL res = ...;
URLConnection conn = res.openConnection();
conn.setDoOutput(true);
OutputStream out = conn.getOutputStream();
....
Of course, you'd want lots of error checking, too.
It's still butt-ugly.
Or, more simply,
URL res = ...;
String path = res.getPath();
OutputStrem out = new FileOutputStream(path);
...
I think you should be guaranteed a file URL from getResource(), at least
in the situations where this whole approach is viable (i.e. where the
target file is going to be a writable resource).
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]