// quickhack for copying files and replace
package com.db4o.lib;

import java.io.*;

public class File extends java.io.File
{
	public File(String a_path){
		super(a_path);
	}
	
	public File copy(String a_to){
		new File(a_to).mkdirs();
		com.db4o.lib.File l_File  = null;
		int l_len;
		try{
			RandomAccessFile raf = new RandomAccessFile(getAbsolutePath(),"r");
			l_len = (int)raf.length();
			byte[] l_bytes = new byte[l_len];
			raf.read(l_bytes,0,l_len);
			raf.close();
			l_File = new com.db4o.lib.File(a_to);
			l_File.delete();
			raf = new RandomAccessFile(a_to,"rw");
			raf.write(l_bytes);
			raf.close();
			l_File = new com.db4o.lib.File(a_to);
		}
		catch(Exception e){}
		return l_File;
	}
	
	public void replace(String a_replace, String a_with){
		CrepFile l_CrepFile = new CrepFile(getAbsolutePath());
		l_CrepFile.replace(a_replace, a_with);
	}
}
