On 6/7/06, Cimballi <[EMAIL PROTECTED]> wrote:
The directory have to exists, the javadoc only talks about the file.
Form source :
public static void writeStringToFile(File file,
String data, String encoding) throws IOException {
OutputStream out = new FileOutputStream(file);
try {
IOUtils.write(data, out, encoding);
} finally {
IOUtils.closeQuietly(out);
}
}
Cimballi
> So, is there anyone on this list that can/will provide a definitive
answer
> to my original question? Should I be asking it elsewhere? Thanks.
>
> --
> Jamie Bisotti
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
As I mentioned in my original post...The JavaDoc for writeStringToFile()
says: "Writes a String to a file creating the file if it does not exist."
That seems to imply that directories would be created, if need be; however,
that is not happening. Is this a bug? Or does the documentation just need
to be clarified?
It does not say anything about directories having to exist; it says the file
will be created if it does not exist. Taking the JavaDoc comment as
literally as possible, if I have an existing directory structure like this:
/parentDirectory
and I call,
FileUtils.writeStringToFile( new File(
"/parentDirectory/childDirectory/grandChildDirectory", "myFile.txt" ), "Foo
bar", "UTF-8" );
I would think /parentDirectory/childDirectory/grandChildDirectory/myFile.txt
would get created. So, my original question still stands: Is this a bug or
an incomplete comment, in need of clarification?
Thanks.
--
Jamie Bisotti