Writes the report to a file. The report is written to the archive direcory as specified by
the property {@link JFunkConstants#ARCHIVE_DIR}.
559915
@Override
	public synchronized void createReport() throws IOException {
		if (reportLines.isEmpty()) {
			log.debug("No data to report. Skipping report generation.");
			return;
		}

		File reportFile = new File(archiveDir.get(), createFileName());

		log.debug("Writing report to file: {}", reportFile);

		String header = getHeaderLine();
		if (header != null) {
			reportLines.addFirst(header);
		}
		FileUtils.writeLines(reportFile, charset == null ? defaultCharset.name() : charset.name(), reportLines);

		reportLines.clear();
	}
893490
@Override
	protected void writeTo(JournalFile journalFile) throws JournalException
    {
    	super.writeTo(journalFile);
    	journalFile.writeInt(operationsCount);
    }
1105175
public void writeTo(Path directory) throws IOException {
    checkArgument(Files.notExists(directory) || Files.isDirectory(directory),
        "path %s exists but is not a directory.", directory);
    Path outputDirectory = directory;
    if (!packageName.isEmpty()) {
      for (String packageComponent : packageName.split("\\.")) {
        outputDirectory = outputDirectory.resolve(packageComponent);
      }
      Files.createDirectories(outputDirectory);
    }

    Path outputPath = outputDirectory.resolve(typeSpec.name + ".java");
    try (Writer writer = new OutputStreamWriter(Files.newOutputStream(outputPath), UTF_8)) {
      writeTo(writer);
    }
  }
506892
public void writeTiff() {
		if (directory.getWriteRasters() != null) {
			TIFFImage tiffImage = new TIFFImage();
			tiffImage.add(directory);
			try {
				imageBytes = TiffWriter.writeTiffToBytes(tiffImage);
			} catch (IOException e) {
				throw new GeoPackageException("Failed to write TIFF image", e);
			}
		}
	}
101076
public void writeFileDesc()
    {
    // Now write the record classes for any other records belonging in this source file
        ClassInfo classInfo = new ClassInfo(this);
        String strFileNameTarget = m_strFileName;
        String strBaseFileName = DBConstants.BLANK;
        classInfo.setKeyArea(ClassInfo.CLASS_SOURCE_FILE_KEY);
        if ((m_strFileName != null)
            && (m_strFileName.length() != 0))
        {
            StringSubFileFilter fileBehavior = new StringSubFileFilter(m_strFileName, ClassInfo.CLASS_SOURCE_FILE, null, null, null, null);
            fileBehavior.setEndKey(false);          // Manually check for EOF
            classInfo.addListener(fileBehavior);    // Only select records which match m_strFileName
        }
        if (m_strPackage.length() != 0)
            classInfo.addListener(new CompareFileFilter(ClassInfo.CLASS_PACKAGE, m_strPackage, "=", null, false));
        if (m_strProjectID.length() != 0)
            classInfo.addListener(new CompareFileFilter(ClassInfo.CLASS_PROJECT_ID, m_strProjectID, "=", null, false));

        try   {
            classInfo.close();
            while (classInfo.hasNext())
            {
                classInfo.next();
                if ((m_strFileName == null) || (m_strFileName.length() == 0))
                    if ((m_systemName != null) && (!"base".equalsIgnoreCase(Utility.getSystemSuffix(m_systemName, null))) && (!"_base".equalsIgnoreCase(Utility.getSystemSuffix(m_systemName, null))))
                        if (classInfo.getCounterField().getValue() >= 16777216)
                            continue;   // There must be a better way to tell if this belongs in a base table
                String strClassName = classInfo.getField(ClassInfo.CLASS_NAME).getString();
                String strRecordType = classInfo.getField(ClassInfo.CLASS_TYPE).getString();
                if (strRecordType.length() == 0)
                    strRecordType = " ";
                //String strPackage =  classInfo.getField(ClassInfo.CLASS_PACKAGE).getString();
                String strFileName = classInfo.getField(ClassInfo.CLASS_SOURCE_FILE).getString();
                Record classProject = ((ReferenceField)classInfo.getField(ClassInfo.CLASS_PROJECT_ID)).getReference();
                if (classProject != null)
                	if ((classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS) || (classProject.getEditMode() == DBConstants.EDIT_CURRENT))
                		if (classProject.getField(ClassProject.SYSTEM_CLASSES).getState() == true)	// Special system classes, don't generate!
                        strFileName = DBConstants.BLANK; // Skip these
                if (strFileName.length() == 0)
                    continue;
                if (!strBaseFileName.equals(strFileName))
                {
                    if (strBaseFileName.length() != 0)
                    {   // Not the first file
                        if ((strFileNameTarget != null) && (strFileNameTarget.length() > 0))
                            if (strFileName.length() < strFileNameTarget.length())
                                break;  // EOF
                        if ((strFileNameTarget != null) && (strFileNameTarget.length() > 0))
                            if (strFileName.substring(0, strFileNameTarget.length()).compareTo(strFileNameTarget) > 0)
                                break;  // EOF
                        
                        m_ClassNameList.free();
                        m_ClassNameList = null;
                    }

                    NameList aClassNameList = new NameList();
                    m_ClassNameList = aClassNameList;

                    strBaseFileName = strFileName;    // Current File
                }
                this.writeThisClass(strClassName, strRecordType);
            } // End of write record method(s) loop
            classInfo.close();
        } catch (DBException ex)   {
            ex.printStackTrace();
        }
    }
1021604
public void write(WARCWritable record) throws IOException {
        if (record.getRecord() != null) write(record.getRecord());
    }
845389
public void write(ObjectWriter out, PersistedValueData vd) throws IOException
   {
      out.writeInt(SerializationConstants.PERSISTED_VALUE_DATA);
      out.writeInt(vd.getOrderNumber());

      boolean isByteArray = vd.isByteArray();
      out.writeBoolean(isByteArray);

      if (isByteArray)
      {
         byte[] data = vd.getAsByteArray();
         out.writeInt(data.length);
         out.write(data);
      }
      else
      {
         // write file content
         FilePersistedValueData streamed = (FilePersistedValueData)vd;

         InputStream in = null;

         if (streamed.getFile() == null && vd instanceof StreamPersistedValueData)
         {
            if (((StreamPersistedValueData)vd).getTempFile() != null)
            {
               in = PrivilegedFileHelper.fileInputStream(((StreamPersistedValueData)vd).getTempFile());
            }
         }
         else
         {
            in = streamed.getAsStream();
         }

         if (streamed.getFile() instanceof SerializationSpoolFile)
         {
            SerializationSpoolFile ssf = (SerializationSpoolFile)streamed.getFile();
            out.writeString(ssf.getId());
            out.writeLong(0);
         }
         else
         {
            // write property id - used for reread data optimization
            String id = IdGenerator.generate();
            out.writeString(id);

            if (in == null)
            {
               // Deleted state usecase
               out.writeLong(SerializationConstants.NULL_FILE);
            }
            else
            {
               out.writeLong(vd.getLength());
               try
               {
                  byte[] buf = new byte[SerializationConstants.INTERNAL_BUFFER_SIZE];
                  int l = 0;
                  while ((l = in.read(buf)) >= 0)
                  {
                     out.write(buf, 0, l);
                  }
               }
               finally
               {
                  in.close();
               }
            }
         }
      }
   }
689057
public void writeToFile(File f) {
		try (FileOutputStream fos = new FileOutputStream(f)) {
			fos.write(write());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
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);
	}
104677
@Override
	protected void writeTo(JournalFile journalFile) throws JournalException
    {
    	super.writeTo(journalFile);
    	journalFile.writeInt(blockSize);
    	journalFile.writeInt(oldBlockCount);
    	journalFile.writeInt(newBlockCount);
    }
1002547
void report(Class c) {
        if (!get().contains(c)) {
            try {
                append(c.getName());
            } catch (IOException e) {
                LOGGER.log(Level.WARNING, "Failed to persist " + file, e);
            }
        }
    }
89980
@Override
	public synchronized void write(byte[] b, int off, int len)
			throws IOException {
		consolidateSoftCopy();
		alertSoftCopies();
		super.write(b, off, len);
	}
575311
public static void write(String fileName, Collection<? extends Object> entries) {
        if (fileName == null) {
            throw new IllegalArgumentException("Must specify a file name to write to");
        }
        PrintWriter writer = null;
        File file = new File(fileName);
        try {
            file.mkdirs();
            if (file.exists()) {
                file.delete();
            }
            writer = new PrintWriter(new FileWriter(file), true);
            for (Object entry : entries) {
                writer.println(String.valueOf(entry));
            }
        }
        catch (Exception e) {
            throw new RuntimeException("Problem writing to " + file.getAbsolutePath(), e);
        }
        finally {
            try {
            	if(writer != null) {
            		writer.close();
                }
            }
            catch (Exception e) {
                //
            }
        }
    }
32452
private void writeFileForm(OutputStream out) throws IOException {
		for (Entry<String, Resource> entry : this.fileForm.entrySet()) {
			appendPart(entry.getKey(), entry.getValue(), out);
		}
	}
1140511
public final void writeTo(DataOutput dout) throws IOException {
        dout.writeShort(mNameConstant.getIndex());
        dout.writeInt(getLength());
        writeDataTo(dout);
    }
457299
public void writeToDirectory(@NotNull LanguageProfile languageProfile, @NotNull File fullPath) throws IOException {
        if (!fullPath.exists()) {
            throw new IOException("Path does not exist: "+fullPath);
        }
        if (!fullPath.canWrite()) {
            throw new IOException("Path not writable: "+fullPath);
        }
        File file = new File(fullPath.getAbsolutePath()+"/"+languageProfile.getLocale());
        if (file.exists()) {
            throw new IOException("File exists already, refusing to overwrite: "+file);
        }
        try (FileOutputStream output = new FileOutputStream(file)) {
            write(languageProfile, output);
        }
    }
132453
public static void writeToFile(Bitmap bitmap, String dir, String filename) throws FileNotFoundException, IOException {
		File sdCard = Environment.getExternalStorageDirectory();
		File dirFile = new File (sdCard.getAbsolutePath() + "/" + dir);
		dirFile.mkdirs();
		File f = new File(dirFile, filename);
		FileOutputStream fos = new FileOutputStream(f, false);
		bitmap.compress(CompressFormat.PNG, 100 /*ignored for PNG*/, fos);
		fos.flush();
		fos.close();
	}