Write the current workbook to a file

@param aFile
The file to write to. May not be <code>null</code>.
@return {@link ESuccess}
519140
@Nonnull
  public ESuccess writeTo (@Nonnull final File aFile)
  {
    return writeTo (FileHelper.getOutputStream (aFile));
  }
194683
void writeJsFile(TypeElement element, ElementVisitor visitor, String packagePath, String fn) {
		try (Writer w = fws.getFileObjectWriterInClassOutput(packagePath, fn)) {
			element.accept(visitor, w);
		} catch (IOException ioe) {
			messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " FAILED TO CREATE : " + packagePath + "." + fn);
		}
	}
154480
function fileSystem(context, file, fileSet, next) {
  var destinationPath

  if (!context.output) {
    debug('Ignoring writing to file-system')
    return next()
  }

  if (!file.data.unifiedEngineGiven) {
    debug('Ignoring programmatically added file')
    return next()
  }

  destinationPath = file.path

  if (!destinationPath) {
    debug('Cannot write file without a `destinationPath`')
    return next(new Error('Cannot write file without an output path'))
  }

  if (stats(file).fatal) {
    debug('Cannot write file with a fatal error')
    return next()
  }

  destinationPath = resolve(context.cwd, destinationPath)
  debug('Writing document to `%s`', destinationPath)

  file.stored = true

  writeFile(destinationPath, file.toString(), next)
}
1209522
function writeFile(pathToFile, content, verbose) {
  var directory = _path2.default.dirname(pathToFile);

  // Create directory if it doesn't exist
  if (!_fs2.default.existsSync(directory)) {
    _fs2.default.mkdirSync(directory);
  }

  // Try to write file to disk to the given location
  _fs2.default.writeFile(pathToFile, content, { flag: 'w' }, function (error) {
    if (error) {
      throw new Error(error);
    }

    // Log success message to the console if in verbose mode only
    if (verbose) {
      var successMessage = '\nVersion file written to ' + _chalk2.default.green(pathToFile);

      console.log(successMessage);
    }
  });
}
354316
public static <T> void writeWorkBook(File file, int excelType, List<T> beans) throws WriteExcelException {
        WriteExcelUtils.writeWorkBook(file, excelType, beans, null);
    }
870173
public void copyFile(DocFile fromFile) throws DocFileIOException {
        try (OutputStream output = openOutputStream()) {
            try (InputStream input = fromFile.openInputStream()) {
                byte[] bytearr = new byte[1024];
                int len;
                while ((len = read(fromFile, input, bytearr)) != -1) {
                    write(this, output, bytearr, len);
                }
            } catch (IOException e) {
                throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e);
            }
        } catch (IOException e) {
            throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
        }
    }
1226174
private static void doCopyFile(final File srcFile, final File destFile, final boolean preserveFileDate) {
        if (destFile.exists()) {
            throw new IllegalArgumentException("The destination file already existed: " + destFile.getAbsolutePath());
        }

        FileInputStream fis = null;
        FileOutputStream fos = null;
        FileChannel input = null;
        FileChannel output = null;

        try {
            fis = new FileInputStream(srcFile);
            fos = new FileOutputStream(destFile);
            input = fis.getChannel();
            output = fos.getChannel();

            long size = input.size();
            long pos = 0;
            long count = 0;

            while (pos < size) {
                count = ((size - pos) > FILE_COPY_BUFFER_SIZE) ? FILE_COPY_BUFFER_SIZE : (size - pos);
                pos += output.transferFrom(input, pos, count);
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            close(output);
            close(fos);
            close(input);
            close(fis);
        }

        if (srcFile.length() != destFile.length()) {
            deleteAllIfExists(destFile);
            throw new UncheckedIOException(new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'"));
        }

        if (preserveFileDate) {
            destFile.setLastModified(srcFile.lastModified());
        }
    }
782171
def write(self, data, method='w'):
        
        # Create list of lists from flat list
        data = data if isinstance(data[0], (list, set, tuple)) else [[d] for d in data]

        # Open file and write rows
        with open(self.file_path, method) as write:
            wr = csv_builtin.writer(write)
            wr.writerows(data)
        return self.file_path
1356408
public <T> File writeLines(Collection<T> list, boolean isAppend) throws IORuntimeException {
		return writeLines(list, null, isAppend);
	}
1189230
protected boolean writeFile(QualifiedName name, ExtraLanguageAppendable appendable, IExtraLanguageGeneratorContext context) {
		final ExtraLanguageAppendable fileAppendable = createAppendable(null, context);
		generateFileHeader(name, fileAppendable, context);

		final ImportManager importManager = appendable.getImportManager();
		if (importManager != null && !importManager.getImports().isEmpty()) {
			for (final String imported : importManager.getImports()) {
				final QualifiedName qn = getQualifiedNameConverter().toQualifiedName(imported);
				generateImportStatement(qn, fileAppendable, context);
			}
			fileAppendable.newLine();
		}

		fileAppendable.append(appendable.getContent());
		final String content = fileAppendable.getContent();

		if (!Strings.isEmpty(content)) {
			final String fileName = toFilename(name, FILENAME_SEPARATOR);
			final String outputConfiguration = getOutputConfigurationName();
			if (Strings.isEmpty(outputConfiguration)) {
				context.getFileSystemAccess().generateFile(fileName, content);
			} else {
				context.getFileSystemAccess().generateFile(fileName, outputConfiguration, content);
			}
			return true;
		}
		return false;
	}
660874
int writeToFile() throws IOException {
		if (storageDisabled) {
			return -1;
		}
		final File file = getFile();
		if (counter.getRequestsCount() == 0 && counter.getErrorsCount() == 0 && !file.exists()) {
			// s'il n'y a pas de requête, inutile d'écrire des fichiers de compteurs vides
			// (par exemple pour le compteur ejb s'il n'y a pas d'ejb)
			return -1;
		}
		final File directory = file.getParentFile();
		if (!directory.mkdirs() && !directory.exists()) {
			throw new IOException("JavaMelody directory can't be created: " + directory.getPath());
		}
		return writeToFile(counter, file);
	}
747013
public static String read(final File aFile) throws IOException {
        String string = new String(readBytes(aFile), StandardCharsets.UTF_8.name());

        if (string.endsWith(EOL)) {
            string = string.substring(0, string.length() - 1);
        }

        return string;
    }
589870
private function insert(File $aFile)
    {
        $sql = 'INSERT INTO file (id, name, extension, mime_type, created_on, updated_on) VALUES (:id, :name, :extension, :mimeType, :createdOn, :updatedOn)';
        $this->execute($sql, [
            'id'        => $aFile->id()->id(),
            'name'      => $aFile->name()->name(),
            'extension' => $aFile->name()->extension(),
            'mimeType'  => $aFile->mimeType(),
            'createdOn' => $aFile->createdOn()->format(self::DATE_FORMAT),
            'updatedOn' => $aFile->updatedOn()->format(self::DATE_FORMAT),
        ]);
    }
140608
public static void generate(ConfigurationImpl configuration, ModuleElement mdle) throws DocFileIOException {
        DocPath filename = DocPaths.moduleFrame(mdle);
        ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename);
        modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle);
    }
281891
public void writeExcelFile() throws IOException, WriteException {
        WritableWorkbook excelWrkBook = null;
        int curDsPointer = 0;

        try {
            final String[] columnNames = ds.getColumns();
            final List<String> exportOnlyColumnsList = getExportOnlyColumns() != null ? Arrays.asList(exportOnlyColumns) : null;
            final List<String> excludeFromExportColumnsList = getExcludeFromExportColumns() != null ? Arrays.asList(excludeFromExportColumns) : null;
            final List<String> numericColumnList = getNumericColumns() != null ? Arrays.asList(getNumericColumns()) : new ArrayList<>();
            // get the current position of the DataSet. We have to go to the top
            // to do this write,
            // and we will put the pionter back where it was after we are done
            curDsPointer = ds.getIndex();
            ds.goTop();

            excelWrkBook = Workbook.createWorkbook(xlsFile);
            final WritableSheet wrkSheet = excelWrkBook.createSheet("results", 0);

            final WritableFont times10ptBold = new WritableFont(WritableFont.TIMES, 10, WritableFont.BOLD);
            final WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10, WritableFont.NO_BOLD);
            // write the column headings in the spreadsheet
            WritableCellFormat cellFormat = new WritableCellFormat(times10ptBold);
            int colOffset = 0;
            for (int i = 0; i < columnNames.length; i++) {
                if (exportOnlyColumnsList != null && !exportOnlyColumnsList.contains(columnNames[i])
                        || excludeFromExportColumnsList != null && excludeFromExportColumnsList.contains(columnNames[i])) {
                    colOffset++;
                    continue;
                }

                final Label xlsTextLbl = new Label(i - colOffset, 0, columnNames[i], cellFormat);
                wrkSheet.addCell(xlsTextLbl);
            }

            cellFormat = new WritableCellFormat(times10pt);
            int row = 1;
            while (ds.next()) {
                if (!ds.isRecordID(FPConstants.DETAIL_ID)) {
                    continue;
                }

                colOffset = 0;
                for (int i = 0; i < columnNames.length; i++) {
                    if (exportOnlyColumnsList != null && !exportOnlyColumnsList.contains(columnNames[i])
                            || excludeFromExportColumnsList != null && excludeFromExportColumnsList.contains(columnNames[i])) {
                        colOffset++;
                        continue;
                    }

                    WritableCell wc = null;
                    if (numericColumnList.contains(columnNames[i])) {
                        wc = new Number(i - colOffset, row, ds.getDouble(columnNames[i]), cellFormat);
                    } else {
                        wc = new Label(i - colOffset, row, ds.getString(columnNames[i]), cellFormat);
                    }

                    wrkSheet.addCell(wc);
                }

                row++;
            }

            excelWrkBook.write();

        } finally {
            if (curDsPointer > -1) {
                ds.absolute(curDsPointer);
            }
            if (excelWrkBook != null) {
                excelWrkBook.close();
            }
        }

    }
856624
private void writeObject (final ObjectOutputStream aOS) throws IOException
  {
    // Read the data
    if (m_aDFOS.isInMemory ())
    {
      _ensureCachedContentIsPresent ();
    }
    else
    {
      m_aCachedContent = null;
      m_aDFOSFile = m_aDFOS.getFile ();
    }

    // write out values
    aOS.defaultWriteObject ();
  }
497887
public static <T> Workbook writeWorkBook(Workbook workbook, int count, List<T> beans, List<String> properties,
                                             List<String> titles, String dateFormat) {
        return WriteExcelUtils.writeWorkBook(workbook, 0, count, beans, properties, titles, dateFormat);
    }