* @param tmpDir The directory where the new file should be created.
* @return The copy.
*/
protected EFile copyToTempFile(ReadWritableFile f, DirectoryView tmpDir)
{
EFile res = (EFile) tmpDir.newEntity(ETFile.TYPE, "sctxdb." + RANDOM.nextInt(Integer.MAX_VALUE), null);
try
{
WritableByteChannel wbc = res.openChannelForWrite();
try
{
ReadableByteChannel rbc = f.openChannelForRead();
try
{