WriteResources Method.
776777
public void writeResources()
    {
        StreamOut out = null;
        Record registration = this.getMainRecord();
        Resource resource = (Resource)this.getRecord(Resource.RESOURCE_FILE);
        
        String strCurrentFileName = "none";
        String strCurrentLanguage = "none";
        String strCurrentLocale = "none";
        try   {
            registration.setKeyArea(Registration.RESOURCE_ID_KEY);
            registration.close();
            boolean bFirstTime = true;
            boolean bResourceListBundle = true;
            while (registration.hasNext())
            {
                registration.next();
        
                String strFileName = resource.getField(Resource.CODE).toString();
                String strLanguage = registration.getField(Registration.LANGUAGE).toString();
                String strLocale = registration.getField(Registration.LOCALE).toString();
                
                if ((!strCurrentFileName.equals(strFileName))
                    || (!strCurrentLanguage.equals(strLanguage))
                    || (!strCurrentLocale.equals(strLocale)))
                { // New file
                    if (out != null)
                        this.printEndFile(out, strCurrentFileName, bResourceListBundle);   // End file stuff
                    out = null;
        
                    if (ResourceTypeField.PROPERTIES.equals(resource.getField(Resource.TYPE).getString()))
                        bResourceListBundle = false;
                    else
                        bResourceListBundle = true;
        
                        // Start new file
                    strCurrentFileName = strFileName;
                    strCurrentLanguage = strLanguage;
                    strCurrentLocale = strLocale;
                    String packageName = resource.getField(Resource.LOCATION).toString();
                    strFileName += "Resources";
                    if (strLanguage != null)
                        if (strLanguage.length() > 0)
                            strFileName += "_" + strLanguage;
                    if (strLocale != null)
                        if (strLocale.length() > 0)
                            strFileName += "_" + strLocale;
                    ClassProject recClassProject = (ClassProject)((ReferenceField)resource.getField(Resource.CLASS_PROJECT_ID)).getReference();
                    strFileName = strFileName.replace('.', '/');
                    String basePackageName = packageName;
                    if (basePackageName.startsWith("." + DBConstants.RES_SUBPACKAGE.substring(0, DBConstants.RES_SUBPACKAGE.length() - 1)))
                        basePackageName = basePackageName.substring(DBConstants.RES_SUBPACKAGE.length()); // Get rid of ".res".. it will be added back later
                    String strFullFileName = recClassProject.getFileName(strFileName, basePackageName, bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES, true, true);
                    packageName = recClassProject.getFullPackage(bResourceListBundle ? ClassProject.CodeType.RESOURCE_CODE : ClassProject.CodeType.RESOURCE_PROPERTIES, packageName);
                    out = this.createFile(strFullFileName);
                    out.writeit(this.getStartSourceCode(packageName, strFileName, resource.getField(Resource.DESCRIPTION).toString(), bResourceListBundle));
                    if (bResourceListBundle)
                    {
                        out.writeit("   static final Object[][] contents = {\n");
                        out.writeit("     // LOCALIZE THIS\n");
                    }
                    bFirstTime = true;
                }
                if (!bFirstTime)
                {
                    if (bResourceListBundle)
                        out.writeit(",\n");
                    else
                        out.writeit("\n");
                }
                bFirstTime = false;
                this.writeDetailLine(registration, out, bResourceListBundle);
            }
            if (out != null)
                this.printEndFile(out, strCurrentFileName, bResourceListBundle);   // End file stuff
            out = null;
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
    }
1139730
public void write(Workspace workspace, Writer writer) {
        workspace.getViews().getSystemContextViews().forEach(v -> write(v, null, writer));
        workspace.getViews().getContainerViews().forEach(v -> write(v, v.getSoftwareSystem(), writer));
        workspace.getViews().getComponentViews().forEach(v -> write(v, v.getContainer(), writer));
    }
825801
public static void prependSoSource(SoSource extraSoSource) throws IOException {
    sSoSourcesLock.writeLock().lock();
    try {
      Log.d(TAG, "Prepending to SO sources: " + extraSoSource);
      assertInitialized();
      extraSoSource.prepare(makePrepareFlags());
      SoSource[] newSoSources = new SoSource[sSoSources.length + 1];
      newSoSources[0] = extraSoSource;
      System.arraycopy(sSoSources, 0, newSoSources, 1, sSoSources.length);
      sSoSources = newSoSources;
      sSoSourcesVersion++;
      Log.d(TAG, "Prepended to SO sources: " + extraSoSource);
    } finally {
      sSoSourcesLock.writeLock().unlock();
    }
  }
1157989
private static Map<WriterKind, PrintWriter> initWriters(Context context) {
        PrintWriter out = context.get(outKey);
        PrintWriter err = context.get(errKey);
        if (out == null && err == null) {
            out = new PrintWriter(System.out, true);
            err = new PrintWriter(System.err, true);
            return initWriters(out, err);
        } else if (out == null || err == null) {
            PrintWriter pw = (out != null) ? out : err;
            return initWriters(pw, pw);
        } else {
            return initWriters(out, err);
        }
    }
100626
def _write_source_data(self, sources):
        
        for i, source in enumerate(sources):
            self._write_source(source)
1296163
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
        // Write out capacity and any hidden stuff
        s.defaultWriteObject();
    }
780184
private Response writeResource(final String method, final String body) throws IOException {
		buildQueryString();
		buildHeaders();

		connection.setDoOutput(true);
		connection.setRequestMethod(method);

		writer = new OutputStreamWriter(connection.getOutputStream());
		writer.write(body);
		writer.close();

		return readResponse();
	}
126804
private Project.Resources.Resource writeResource(Resource mpx)
   {
      Project.Resources.Resource xml = m_factory.createProjectResourcesResource();
      ProjectCalendar cal = mpx.getResourceCalendar();
      if (cal != null)
      {
         xml.setCalendarUID(NumberHelper.getBigInteger(cal.getUniqueID()));
      }

      xml.setAccrueAt(mpx.getAccrueAt());
      xml.setActiveDirectoryGUID(mpx.getActiveDirectoryGUID());
      xml.setActualCost(DatatypeConverter.printCurrency(mpx.getActualCost()));
      xml.setActualOvertimeCost(DatatypeConverter.printCurrency(mpx.getActualOvertimeCost()));
      xml.setActualOvertimeWork(DatatypeConverter.printDuration(this, mpx.getActualOvertimeWork()));
      xml.setActualOvertimeWorkProtected(DatatypeConverter.printDuration(this, mpx.getActualOvertimeWorkProtected()));
      xml.setActualWork(DatatypeConverter.printDuration(this, mpx.getActualWork()));
      xml.setActualWorkProtected(DatatypeConverter.printDuration(this, mpx.getActualWorkProtected()));
      xml.setACWP(DatatypeConverter.printCurrency(mpx.getACWP()));
      xml.setAvailableFrom(mpx.getAvailableFrom());
      xml.setAvailableTo(mpx.getAvailableTo());
      xml.setBCWS(DatatypeConverter.printCurrency(mpx.getBCWS()));
      xml.setBCWP(DatatypeConverter.printCurrency(mpx.getBCWP()));
      xml.setBookingType(mpx.getBookingType());
      xml.setIsBudget(Boolean.valueOf(mpx.getBudget()));
      xml.setCanLevel(Boolean.valueOf(mpx.getCanLevel()));
      xml.setCode(mpx.getCode());
      xml.setCost(DatatypeConverter.printCurrency(mpx.getCost()));
      xml.setCostPerUse(DatatypeConverter.printCurrency(mpx.getCostPerUse()));
      xml.setCostVariance(DatatypeConverter.printCurrency(mpx.getCostVariance()));
      xml.setCreationDate(mpx.getCreationDate());
      xml.setCV(DatatypeConverter.printCurrency(mpx.getCV()));
      xml.setEmailAddress(mpx.getEmailAddress());
      xml.setFinish(mpx.getFinish());
      xml.setGroup(mpx.getGroup());
      xml.setGUID(mpx.getGUID());
      xml.setHyperlink(mpx.getHyperlink());
      xml.setHyperlinkAddress(mpx.getHyperlinkAddress());
      xml.setHyperlinkSubAddress(mpx.getHyperlinkSubAddress());
      xml.setID(NumberHelper.getBigInteger(mpx.getID()));
      xml.setInitials(mpx.getInitials());
      xml.setIsEnterprise(Boolean.valueOf(mpx.getEnterprise()));
      xml.setIsGeneric(Boolean.valueOf(mpx.getGeneric()));
      xml.setIsInactive(Boolean.valueOf(!mpx.getActive()));
      xml.setIsNull(Boolean.valueOf(mpx.getNull()));
      xml.setMaterialLabel(mpx.getMaterialLabel());
      xml.setMaxUnits(DatatypeConverter.printUnits(mpx.getMaxUnits()));
      xml.setName(mpx.getName());

      if (!mpx.getNotes().isEmpty())
      {
         xml.setNotes(mpx.getNotes());
      }

      xml.setNTAccount(mpx.getNtAccount());
      xml.setOverAllocated(Boolean.valueOf(mpx.getOverAllocated()));
      xml.setOvertimeCost(DatatypeConverter.printCurrency(mpx.getOvertimeCost()));
      xml.setOvertimeRate(DatatypeConverter.printRate(mpx.getOvertimeRate()));
      xml.setOvertimeRateFormat(DatatypeConverter.printTimeUnit(mpx.getOvertimeRateUnits()));
      xml.setOvertimeWork(DatatypeConverter.printDuration(this, mpx.getOvertimeWork()));
      xml.setPeakUnits(DatatypeConverter.printUnits(mpx.getPeakUnits()));
      xml.setPercentWorkComplete(NumberHelper.getBigInteger(mpx.getPercentWorkComplete()));
      xml.setPhonetics(mpx.getPhonetics());
      xml.setRegularWork(DatatypeConverter.printDuration(this, mpx.getRegularWork()));
      xml.setRemainingCost(DatatypeConverter.printCurrency(mpx.getRemainingCost()));
      xml.setRemainingOvertimeCost(DatatypeConverter.printCurrency(mpx.getRemainingOvertimeCost()));
      xml.setRemainingOvertimeWork(DatatypeConverter.printDuration(this, mpx.getRemainingOvertimeWork()));
      xml.setRemainingWork(DatatypeConverter.printDuration(this, mpx.getRemainingWork()));
      xml.setStandardRate(DatatypeConverter.printRate(mpx.getStandardRate()));
      xml.setStandardRateFormat(DatatypeConverter.printTimeUnit(mpx.getStandardRateUnits()));
      xml.setStart(mpx.getStart());
      xml.setSV(DatatypeConverter.printCurrency(mpx.getSV()));
      xml.setUID(mpx.getUniqueID());
      xml.setWork(DatatypeConverter.printDuration(this, mpx.getWork()));
      xml.setWorkGroup(mpx.getWorkGroup());
      xml.setWorkVariance(DatatypeConverter.printDurationInDecimalThousandthsOfMinutes(mpx.getWorkVariance()));

      if (mpx.getType() == ResourceType.COST)
      {
         xml.setType(ResourceType.MATERIAL);
         xml.setIsCostResource(Boolean.TRUE);
      }
      else
      {
         xml.setType(mpx.getType());
      }

      writeResourceExtendedAttributes(xml, mpx);

      writeResourceBaselines(xml, mpx);

      writeCostRateTables(xml, mpx);

      writeAvailability(xml, mpx);

      return (xml);
   }
328791
def write(url, content, **args):
    """"""
    with HTTPSResource(url, **args) as resource:
        resource.write(content)
1000053
public void setWriter (Writer writer) {
		if (!(writer instanceof JsonWriter)) writer = new JsonWriter(writer);
		this.writer = (JsonWriter)writer;
		this.writer.setOutputType(outputType);
		this.writer.setQuoteLongValues(quoteLongValues);
	}
701512
public Resource write(@NonNull Resource resource) throws IOException {
      Resource stringResource = new StringResource();
      try (PrintStream printStream = new PrintStream(stringResource.outputStream())) {
         print(printStream);
      }
      resource.write(stringResource.readToString());
      return resource;
   }
996121
void setDataSourceLogWriter(PrintWriter writer) throws SQLException {
      for(ConnectionPoolSegment segment : segments) {
         if(segment.dbConnection.datasource != null) {
            segment.dbConnection.datasource.setLogWriter(writer);
         }
      }
   }
109943
private void writeResources()
   {
      Resources resources = m_factory.createResources();
      m_plannerProject.setResources(resources);
      List<net.sf.mpxj.planner.schema.Resource> resourceList = resources.getResource();
      for (Resource mpxjResource : m_projectFile.getResources())
      {
         net.sf.mpxj.planner.schema.Resource plannerResource = m_factory.createResource();
         resourceList.add(plannerResource);
         writeResource(mpxjResource, plannerResource);
      }
   }
114164
private void writeResource(Resource mpxj)
   {
      ResourceType xml = m_factory.createResourceType();
      m_apibo.getResource().add(xml);

      xml.setAutoComputeActuals(Boolean.TRUE);
      xml.setCalculateCostFromUnits(Boolean.TRUE);
      xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getResourceCalendar()));
      xml.setCurrencyObjectId(DEFAULT_CURRENCY_ID);
      xml.setDefaultUnitsPerTime(Double.valueOf(1.0));
      xml.setEmailAddress(mpxj.getEmailAddress());
      xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
      xml.setId(RESOURCE_ID_PREFIX + mpxj.getUniqueID());
      xml.setIsActive(Boolean.TRUE);
      xml.setMaxUnitsPerTime(getPercentage(mpxj.getMaxUnits()));
      xml.setName(mpxj.getName());
      xml.setObjectId(mpxj.getUniqueID());
      xml.setParentObjectId(mpxj.getParentID());
      xml.setResourceNotes(mpxj.getNotes());
      xml.setResourceType(getResourceType(mpxj));
      xml.getUDF().addAll(writeUDFType(FieldTypeClass.RESOURCE, mpxj));
   }
53596
public static void writeResource(final Resource.Writable resource,
                                     final CharSequence content) throws IOException {
        resource.useWriter(writer -> IOUtils.write(content.toString(), writer));
    }
1227384
@Override
    public void writeContent(XMLExtendedStreamWriter writer, Resource value) throws XMLStreamException {

        if(value != null && this != value) {
            throw new IllegalStateException("Wrong target resource.");
        }

        writer.writeStartElement(ModuleConfigImpl.RESOURCE_ROOT);
        writer.writeAttribute(ModuleConfigImpl.PATH, path);
        writer.writeEndElement();
    }
536501
@Override
    public void write(final Writer writer) throws ConfigurationException, IOException {
        Preconditions.checkNotNull(writer);

        @SuppressWarnings("unchecked") final
        HashMap<String, Object> settings = (HashMap<String, Object>) fromNode(this.getModel().getInMemoryRepresentation());
        this.mapper.writerWithDefaultPrettyPrinter().writeValue(writer, settings);
    }