'Write file contents at location relative to path.
Name on disk will be based on internal name unless one is provided.
For mode FILEINMEMORY, file will data() will be called for reconstruction.
After writing to disk, mode will be changed to FILEONDISK.
If mode is already FILEONDISK, file will be moved to new location.'

def write(self, path='.', name=None, clobber=False, errorHandler=None, padding=None, overlap=True):

    olddiskpath = self.diskpath
    if (name == None):
        name = self.name
    self.diskpath = self.__localfilename(name, path, clobber)
    if (self.mode == FILEINMEMORY):
        fh = open(self.diskpath, 'w')
        fh.write(self.data())
        fh.close()
        self.segments = {}
        self.startoffset = 0
        self.endoffset = 0
        return self.diskpath
    elif (self.mode == FILEONDISK):
        move(olddiskpath, self.diskpath)
        return self.diskpath
