* @param to
* @throws IOException
*/
private void rename(String from, String to) throws IOException
{
IndexOutputStream out = null;
IndexInputStream in = null;
try
{
out = new IndexOutputStream(dir.createOutput(to));
in = new IndexInputStream(dir.openInput(from));
DirectoryHelper.transfer(in, out);
}
finally
{
if (in != null)
{
in.close();
}
if (out != null)
{
out.flush();
out.close();
}
}
try
{
// delete old one