if (node == null || node.type != Node.DIR)
throw new IOException(L.l("can't create file {0}", getFullPath()));
Node child = node.lookup(tail);
if (child == null)
child = node.createFile(tail, new ByteBuffer(256));
else if (! append) {
node.remove(tail);
child = node.createFile(tail, new ByteBuffer(256));
}
else if (child.type != child.FILE)
throw new IOException(L.l("can't create file {0}", getFullPath()));
return new MemoryStream(child, (ByteBuffer) child.data, true);
}