Hello,
I had a look at the getOutputStream method of the
org.apache.jackrabbit.core.fs.mem.MemoryFileSystem class, its code is
presented below:
public OutputStream getOutputStream(String filePath) throws
FileSystemException
{
String folderPath = filePath;
if (filePath.lastIndexOf(FileSystem.SEPARATOR) > 0)
{
folderPath = filePath.substring(0, filePath.lastIndexOf("/"));
}
else
{
folderPath = "/";
}
assertIsFolder(folderPath);
final MemoryFile file = new MemoryFile();
entries.put(filePath, file);
return new FilterOutputStream(new ByteArrayOutputStream())
{
public void close() throws IOException
{
out.close();
file.setData(((ByteArrayOutputStream) out).toByteArray());
}
};
}
I might be wrong, but it seems that if the filePath passed points to an
existing folder and not to a file - the folder will be replaced with a
newly created file. Unfortunately, at the moment being I do not have JR
build environment set up to test practically whether this is really the
case. Might be some check whether the path passed really points to a
file should be added.
Best regards
Denis Linine