Writes the file footer (finished the file).
420729
def WriteFileFooter(self):
    """"""

    if not self._stream:
      raise ArchiveAlreadyClosedError(
          "Attempting to write to a ZIP archive that was already closed.")

    if self.cur_cmpr:
      buf = self.cur_cmpr.flush()
      self.cur_compress_size += len(buf)
      self.cur_zinfo.compress_size = self.cur_compress_size

      self._stream.write(buf)
    else:
      self.cur_zinfo.compress_size = self.cur_file_size

    self.cur_zinfo.CRC = self.cur_crc
    self.cur_zinfo.file_size = self.cur_file_size

    # The zip footer has a 8 bytes limit for sizes so if we compress a
    # file larger than 4 GB, the code below will not work. The ZIP64
    # convention is to write 0xffffffff for compressed and
    # uncompressed size in those cases. The actual size is written by
    # the library for us anyways so those fields are redundant.
    cur_file_size = min(0xffffffff, self.cur_file_size)
    cur_compress_size = min(0xffffffff, self.cur_compress_size)

    # Writing data descriptor ZIP64-way by default. We never know how large
    # the archive may become as we're generating it dynamically.
    #
    # crc-32                          8 bytes (little endian)
    # compressed size                 8 bytes (little endian)
    # uncompressed size               8 bytes (little endian)
    self._stream.write(
        struct.pack("<LLL", self.cur_crc, cur_compress_size, cur_file_size))

    # Register the file in the zip file, so that central directory gets
    # written correctly.
    self._zip_fd.filelist.append(self.cur_zinfo)
    self._zip_fd.NameToInfo[self.cur_zinfo.filename] = self.cur_zinfo

    self._ResetState()

    return self._stream.GetValueAndReset()
25074
public void writeToDisk() {
        if ( !initialized ) {
            initializeLog();
        }
        Writer writer = null;
        try {
            FileOutputStream fileOut = new FileOutputStream( this.fileName + (this.nbOfFile == 0 ? ".log" : this.nbOfFile + ".log" ),
                                                             true );
            writer = new OutputStreamWriter( fileOut,
                                             IoUtils.UTF8_CHARSET );
            final XStream xstream = createTrustingXStream();

            WorkingMemoryLog log = null;
            synchronized ( this.events ) {
                log = new WorkingMemoryLog(new ArrayList<LogEvent>( this.events ));
                clear();
            }
            writer.write( xstream.toXML( log ) + "\n" );
        } catch ( final FileNotFoundException exc ) {
            throw new RuntimeException( "Could not create the log file.  Please make sure that directory that the log file should be placed in does exist." );
        } catch ( final Throwable t ) {
            logger.error("error", t);
        } finally {
            if ( writer != null ) {
                try {
                    writer.close();
                } catch ( Exception e ) {
                }
            }
        }
        if ( terminate ) {
            closeLog();
            terminate = true;
        } else if ( split ) {
            closeLog();
            this.nbOfFile++;
            initialized = false;
        }
    }
567291
private void writeTop() throws IOException {
        // setup output HTML file
        File outputFile = new File(outputDirectory, createFilename(currentPageNumber));
        writer = new BufferedWriter(new OutputStreamWriter(
                new FileOutputStream(outputFile, false), Charset.forName(encoding)));

        // write header
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("pageTitle", pageTitle);
        if(pageHeader != null && pageHeader.length() > 0) {
            map.put("header", "<h1>" + pageHeader + "</h1>");
        } else {
            map.put("header","");
        }
        if(pageDescription != null && pageDescription.length() > 0) {
            map.put("description", "<p>" + pageDescription + "</p>");
        } else {
            map.put("description", "");
        }

        String template = Template.readResourceAsStream("com/btaz/util/templates/html-table-header.ftl");
        String output = Template.transform(template, map);
        writer.write(output);
    }
910881
function WriteStream(path, options, flush) {
  // Not exposed so we can avoid the case where someone doesn't use `new`

  if (typeof options === 'function') {
    flush = options;
    options = null;
  }

  options = options || {};

  Writable.call(this, options);

  this.flush = flush;
  this.path = path;

  this.mode = options.mode || constants.DEFAULT_FILE_MODE;
  this.flags = options.flags || 'w';

  // Used by node's `fs.WriteStream`
  this.fd = null;
  this.start = null;

  this.open();

  // Dispose on finish.
  this.once('finish', this.close);
}
373207
public void resetFooter() {
        this.footer = null;
        DocListener listener;
		for (Iterator iterator = listeners.iterator(); iterator.hasNext();) {
            listener = (DocListener) iterator.next();
            listener.resetFooter();
        }
    }
912269
public void write() throws IOException {
		{
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + postfix;
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeGen(fileObject, jsonModel);
		}
		if (jsonModel.isBuilder()) {
			Filer filer = processingEnv.getFiler();
			String generateClassName =
					jsonModel.getPackageName() + "." + jsonModel.getTarget() + "JsonMeta";
			JavaFileObject fileObject = filer.createSourceFile(generateClassName, classElement);
			Template.writeJsonMeta(fileObject, jsonModel);
		}
	}
658089
public function setFileFoot(): void
    {
        // check local service file
        $this->fileFoot = $this->prepareFilePath('foot', false);
        if (!file_exists($this->fileFoot)) {
            // look up for default file
            $this->fileFoot = $this->prepareDefaultFilePath('foot');
        }
    }
1239644
public static void writeFile(IFile file, final FileOutput output, IProgressMonitor monitor) throws CoreException {

        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            output.writeFile(bos);
            ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
            if (!file.exists()) {
                mkdirs(file, monitor);
                file.create(bis, true, monitor);
            } else {
                file.setContents(bis, true, false, monitor);
            }
        } catch (IOException e) {
            IStatus status = FindbugsPlugin.createErrorStatus("Exception while " + output.getTaskDescription(), e);
            throw new CoreException(status);
        }
    }
192729
public function write()
    {
        foreach ($this->parameters as $prop => $value) {
            $placeHolders[] = sprintf('<%s>', $prop);
            $replacements[] = $value;
        }

        $content = str_replace($placeHolders, $replacements, self::$template);

        fwrite($this->file, $this->addHeaders($content));
    }
879698
public function addFileFooter(): void
    {

        if ($this->bits & self::BIT_ZERO_HEADER) {
            $fields = [
                ['V', ZipStream::DATA_DESCRIPTOR_SIGNATURE],
                ['V', $this->crc],              // CRC32
                ['V', $this->zlen],             // Length of compressed data
                ['V', $this->len],              // Length of original data
            ];

            if ($this->zip->opt->isEnableZip64()) {
                $fields = [
                    ['V', ZipStream::DATA_DESCRIPTOR_SIGNATURE],
                    ['V', $this->crc],              // CRC32
                    ['P', $this->zlen],             // Length of compressed data
                    ['P', $this->len],              // Length of original data
                ];
            }

            $footer = ZipStream::packFields($fields);
            $this->zip->send($footer);
        } else {
            $footer = '';
        }
        $this->totalLength = $this->hlen->add($this->zlen)->add(Bigint::init(strlen($footer)));
        $this->zip->addToCdr($this);
    }
1273787
function (r) {
            // If DONE (cancelled), then don't do anything
            if (me.readyState === FileWriter.DONE) {
                return;
            }

            // position always increases by bytes written because file would be extended
            me.position += r;
            // The length of the file is now where we are done writing.

            me.length = me.position;

            // DONE state
            me.readyState = FileWriter.DONE;

            // If onwrite callback
            if (typeof me.onwrite === 'function') {
                me.onwrite(new ProgressEvent('write', { 'target':me }));
            }

            // If onwriteend callback
            if (typeof me.onwriteend === 'function') {
                me.onwriteend(new ProgressEvent('writeend', { 'target':me }));
            }
        }
689057
public void writeToFile(File f) {
		try (FileOutputStream fos = new FileOutputStream(f)) {
			fos.write(write());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
1259934
protected void write(BufferedWriter out, String type, byte[] data) throws IOException
    {
        writeHeader(out, type);
        out.write(this.base64.encode(data, 64));
        out.newLine();
        writeFooter(out, type);
    }
589365
private void writeFile(final String fileName,
                         final byte[] bs,
                         final boolean append) throws IOException {
    FileOutputStream fstr = null;

    try {
      fstr = new FileOutputStream(fileName, append);
      fstr.write(bs);

      // Terminate key with newline
      fstr.write('\n');

      fstr.flush();
    } finally {
      if (fstr != null) {
        fstr.close();
      }
    }
  }
1072643
def close( footer = true )
    return self if @closed
    ::Logsly::Logging182::Appenders.remove(@name)
    @closed = true

    flush

    if footer
      footer = @layout.footer
      unless footer.nil? || footer.empty?
        begin
          write(footer)
        rescue StandardError => err
          ::Logsly::Logging182.log_internal(-2) {err}
        end
      end
    end
    self
  end
999582
private static void writeHeader(Path file) throws IOException {
        try (FileChannel fout = FileChannel.open(file, StandardOpenOption.WRITE)) {

            long size = fout.size();
            int sampleSize = (int) size - 44;

            if (logger.isInfoEnabled()) {
                logger.info("Size  " + sampleSize + " of recording file " + file);
            }

            ByteBuffer headerBuffer = ByteBuffer.allocateDirect(44);
            headerBuffer.clear();
            // RIFF
            headerBuffer.put((byte) 0x52);
            headerBuffer.put((byte) 0x49);
            headerBuffer.put((byte) 0x46);
            headerBuffer.put((byte) 0x46);

            int length = sampleSize + 36;

            // Length
            headerBuffer.put((byte) (length));
            headerBuffer.put((byte) (length >> 8));
            headerBuffer.put((byte) (length >> 16));
            headerBuffer.put((byte) (length >> 24));

            // WAVE
            headerBuffer.put((byte) 0x57);
            headerBuffer.put((byte) 0x41);
            headerBuffer.put((byte) 0x56);
            headerBuffer.put((byte) 0x45);

            // fmt
            headerBuffer.put((byte) 0x66);
            headerBuffer.put((byte) 0x6d);
            headerBuffer.put((byte) 0x74);
            headerBuffer.put((byte) 0x20);

            headerBuffer.put((byte) 0x10);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);

            // format - PCM
            headerBuffer.put((byte) 0x01);
            headerBuffer.put((byte) 0x00);

            // format - MONO
            headerBuffer.put((byte) 0x01);
            headerBuffer.put((byte) 0x00);

            // sample rate:8000
            headerBuffer.put((byte) 0x40);
            headerBuffer.put((byte) 0x1F);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);

            // byte rate
            headerBuffer.put((byte) 0x80);
            headerBuffer.put((byte) 0x3E);
            headerBuffer.put((byte) 0x00);
            headerBuffer.put((byte) 0x00);

            // Block align
            headerBuffer.put((byte) 0x02);
            headerBuffer.put((byte) 0x00);

            // Bits per sample: 16
            headerBuffer.put((byte) 0x10);
            headerBuffer.put((byte) 0x00);

            // "data"
            headerBuffer.put((byte) 0x64);
            headerBuffer.put((byte) 0x61);
            headerBuffer.put((byte) 0x74);
            headerBuffer.put((byte) 0x61);

            // len
            headerBuffer.put((byte) (sampleSize));
            headerBuffer.put((byte) (sampleSize >> 8));
            headerBuffer.put((byte) (sampleSize >> 16));
            headerBuffer.put((byte) (sampleSize >> 24));

            headerBuffer.rewind();

            // lets write header
            fout.position(0);
            fout.write(headerBuffer);
        }
    }
130532
function writeFile(input, output, type) {
    var json    = readFile(input),
        content = getContent(json, type);

    fs.writeFile(output, content, function (err) {
        if (err) {
            throw err;
        }

        console.log('The file "' + output + '" was written successfully!');
    });
}