Dumps statistics.

        @param filename: filename where stats will be dumped, filename is
                         created and must not exist prior to this call.
        @type filename: string
3181
def dump(self, filename):
        
        flags = os.O_WRONLY|os.O_CREAT|os.O_NOFOLLOW|os.O_EXCL
        fd = os.open(filename, flags, 0o0600)
        os.write(fd, bytes(self.__str__(), locale.getpreferredencoding()))
        os.close(fd)
249
def save(self, filename):
        

        with open(filename, 'wb') as savefile:
            pickle.dump(self.__dict__,
                        savefile,
                        protocol=pickle.HIGHEST_PROTOCOL)
38347
def dumpStatsTo(filename):
  """"""
  with open(filename, 'w') as f:
    latest = getStats()
    latest['last-updated'] = time.time()
    json.dump(getStats(), f, cls=StatContainerEncoder)
564306
def cleanup_after_optimize(filename, new_filename, old_format, new_format):
    
    final_filename, bytes_in, bytes_out = _cleanup_after_optimize_aux(
        filename, new_filename, old_format, new_format)
    return stats.ReportStats(final_filename, bytes_count=(bytes_in, bytes_out))
287917
def addFilename( self, filename ):
        
        filename = os.path.normpath(nativestring(filename))
        
        if filename in self._filenames:
            self._filenames.remove(filename)
        
        self._filenames.insert(0, filename)
        self._filenames = self._filenames[:self.maximumLength()]
        
        self.refresh()
818611
public void dumpStats(final String file) throws FileNotFoundException {
		PrintStream out = null;
		try {
			out = new PrintStream(new FileOutputStream(file));
			dumpStats(out);
		} finally {
			try {
				out.close();
			} catch (Exception ign) {
			}
		}
	}
1245549
def save(self, filename=None):
        
        if not filename:
            filename = self.filename
        if not filename:
            raise Exception("No filename specified")
        if filename[-4:].lower() == '.bz2':
            f = bz2.BZ2File(filename,'wb')
            f.write(self.xmlstring().encode('utf-8'))
            f.close()
        elif filename[-3:].lower() == '.gz':
            f = gzip.GzipFile(filename,'wb') #pylint: disable=redefined-variable-type
            f.write(self.xmlstring().encode('utf-8'))
            f.close()
        else:
            f = io.open(filename,'w',encoding='utf-8')
            f.write(self.xmlstring())
            f.close()
1034522
def dump(self, dump_filename, pickle_protocol=pickle.HIGHEST_PROTOCOL):
        
        result = self.result()

        with open(dump_filename, 'wb') as f:
            pickle.dump((self.__class__, result), f, pickle_protocol)
192438
def dump(self, filename):
        """"""
        try:
            with open(filename, 'wb') as fp:
                cPickle.dump(self.counters, fp)
        except Exception as e:
            logging.warning("can't dump counter to file %s: %s", filename, e)
            return False
        return True
370500
public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) {

        if(outputDirName != null) {
            File outputDir = new File(outputDirName);
            if(!outputDir.exists()) {
                Utils.mkdirs(outputDir);
            }

            try {
                FileUtils.writeStringToFile(new File(outputDirName, fileName),
                                            new ClusterMapper().writeCluster(cluster));
            } catch(IOException e) {
                logger.error("IOException during dumpClusterToFile: " + e);
            }
        }
    }
1115862
def to_file(self, filename):
        

        # save compressed file
        xml = self.to_xml()
        f = gzip.open(filename, 'wb')
        try:
            f.write(xml.encode('utf-8'))
        finally:
            f.close()
31117
def write_to_file(self, filename):
        
        if not exists(dirname(filename)):
            return -1
        with open(filename, 'w') as fd:
            needs_json = json.dumps(self.minimum_needs)
            fd.write(needs_json)
        return 0
264547
def sents(self, filename=None):
        
        filename = filename if filename else self.test_file
        with io.open(filename, 'r') as fin:
            for line in fin:
                yield line.strip()
953708
def dump(self, filename=None, compressed=True, pretty=True):
        ''''''
        content = self.server.jsonrpc.dumpWindowHierarchy(compressed, None)
        if filename:
            with open(filename, "wb") as f:
                f.write(content.encode("utf-8"))
        if pretty and "\n " not in content:
            xml_text = xml.dom.minidom.parseString(content.encode("utf-8"))
            content = U(xml_text.toprettyxml(indent='  '))
        return content
1162686
def stats(filename,*args)
    fn = OptArg.quote(filename)
    opt = OptArg.parse(*args)
    puts send_cmd "stats #{fn} #{opt}"
  end
664066
function statistics( $filename = false )
    {
        if ( !$filename )
            $filename = $this->FileName;
        return $this->doStatistics( $filename );
    }
448488
public void write(String filename)
	{
		try
		{
			write(new FileOutputStream(filename));
		}
		catch (FileNotFoundException e)
		{
			e.printStackTrace();
		}
	}