# File lib/ole/storage/base.rb, line 642
      def truncate size
        bat = @dirent.ole.bat_for_size size
        if bat.class != @bat.class
          # bat migration needed! we need to backup some data. the amount of data
          # should be <= @ole.header.threshold, so we can just hold it all in one buffer.
          # backup this
          pos = [@pos, size].min
          self.pos = 0
          keep = read [@size, size].min
          # this does a normal truncate to 0, removing our presence from the old bat, and
          # rewrite the dirent's first_block
          super 0
          @bat = bat
          # just change the underlying io from right under everyone :)
          @io = bat.io
          # important to do this now, before the write. as the below write will always
          # migrate us back to sbat! this will now allocate us +size+ in the new bat.
          super
          self.pos = 0
          write keep
          self.pos = pos
        else
          super
        end
        # now just update the file
        @dirent.size = size
      end