public void moveTo(FilePath path) {
   FilePathSplit newName = (FilePathSplit) path;
   for (int i = 0; ; i++) {
     FilePath o = getBase(i);
     if (o.exists()) {
       o.moveTo(newName.getBase(i));
     } else {
       break;
     }
   }
 }
 public FileChannel truncate(long newLength) throws IOException {
   if (newLength >= length) {
     return this;
   }
   filePointer = Math.min(filePointer, newLength);
   int newFileCount = 1 + (int) (newLength / maxLength);
   if (newFileCount < list.length) {
     // delete some of the files
     FileChannel[] newList = new FileChannel[newFileCount];
     // delete backwards, so that truncating is somewhat transactional
     for (int i = list.length - 1; i >= newFileCount; i--) {
       // verify the file is writable
       list[i].truncate(0);
       list[i].close();
       try {
         file.getBase(i).delete();
       } catch (DbException e) {
         throw DbException.convertToIOException(e);
       }
     }
     System.arraycopy(list, 0, newList, 0, newList.length);
     list = newList;
   }
   long size = newLength - maxLength * (newFileCount - 1);
   list[list.length - 1].truncate(size);
   this.length = newLength;
   return this;
 }
 private FileChannel getFileChannel() throws IOException {
   int id = (int) (filePointer / maxLength);
   while (id >= list.length) {
     int i = list.length;
     FileChannel[] newList = new FileChannel[i + 1];
     System.arraycopy(list, 0, newList, 0, i);
     FilePath f = file.getBase(i);
     newList[i] = f.open(mode);
     list = newList;
   }
   return list[id];
 }
 public String toString() {
   return file.toString();
 }