Writes the list of <code>Resource</code>s to the JSONGenerator.

@param resources
the list of resources to be written.
505829
private void writeResources(List<Resource> resources)
            throws JsonGenerationException, IOException {

        List<String> resourceStrings = new ArrayList<String>();

        for (Resource resource : resources) {
            resourceStrings.add(resource.getId());
        }
        writeJsonArray(JsonDocumentFields.RESOURCE, resourceStrings);
    }
493611
private void writeProperties(JsonGenerator jsonGenerator, ResultSet rs) throws IOException, SQLException {
        if (columnCountProperties != -1) {
            jsonGenerator.writeObjectFieldStart("properties");
            for (Map.Entry<String, Integer> entry : cachedColumnNames.entrySet()) {
                String string = entry.getKey();
                string = string.toLowerCase();
                Integer fieldId = entry.getValue();
                if (rs.getObject(fieldId) instanceof Object[]) {
                    Object[] array = (Object[]) rs.getObject(fieldId);
                    jsonGenerator.writeArrayFieldStart(string);
                    writeArray(jsonGenerator, array, true);
                    jsonGenerator.writeEndArray();
                } else if (rs.getObject(fieldId) != null && rs.getObject(fieldId).equals("{}")){
                    jsonGenerator.writeObjectFieldStart(string);
                    jsonGenerator.writeEndObject();
                } else if (rs.getObject(fieldId) == "null") {
                    jsonGenerator.writeFieldName(string);
                    jsonGenerator.writeNull();
                } else {
                    jsonGenerator.writeObjectField(string, rs.getObject(fieldId));
                }
            }
            jsonGenerator.writeEndObject();
        }
    }
367751
protected void copyResources( List<Resource> resources, String outputDirectory ) throws MojoExecutionException
    {
        initializeFiltering();

        if ( encoding == null || encoding.length() < 1 )
        {
            getLog().info( "Using default encoding to copy filtered resources." );
        }
        else
        {
            getLog().info( "Using encoding: \'" + encoding + "\' to copy filtered resources." );
        }

        for ( Resource resource:  resources )
        {

            String targetPath = resource.getTargetPath();

            File resourceDirectory = new File( resource.getDirectory() );

            if ( !resourceDirectory.exists() )
            {
                continue;
            }

            DirectoryScanner scanner = new DirectoryScanner();

            scanner.setBasedir( resource.getDirectory() );
            if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
            {
                scanner.setIncludes( (String[]) resource.getIncludes().toArray( EMPTY_STRING_ARRAY ) );
            }
            else
            {
                scanner.setIncludes( DEFAULT_INCLUDES );
            }
            if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
            {
                scanner.setExcludes( (String[]) resource.getExcludes().toArray( EMPTY_STRING_ARRAY ) );
            }

            scanner.addDefaultExcludes();
            scanner.scan();

            List<String> includedFiles = Arrays.asList( scanner.getIncludedFiles() );
            for ( String name: includedFiles )
            {

                String destination = name;

                if ( targetPath != null )
                {
                    destination = targetPath + "/" + name;
                }

                File source = new File( resource.getDirectory(), name );

                File destinationFile = new File( outputDirectory, destination );

                if ( !destinationFile.getParentFile().exists() )
                {
                    destinationFile.getParentFile().mkdirs();
                }

                try
                {
                    copyFile( source, destinationFile, resource.isFiltering() );
                }
                catch ( IOException e )
                {
                    throw new MojoExecutionException( "Error copying resources", e );
                }
            }
        }
    }
483069
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();
    jsonGenerator.writeStringField("poolGroupName", poolGroupName);
    jsonGenerator.writeStringField("poolName", poolName);
    jsonGenerator.writeEndObject();
  }
1324748
public void write(JsonGenerator jsonGenerator) throws IOException {
    // We neither need the list of RequestedNodes, nodes, nor excludedHosts,
    // because we can reconstruct them from the request object
    jsonGenerator.writeStartObject();
    jsonGenerator.writeObjectField("request", request);
    jsonGenerator.writeEndObject();
  }
588085
private void writeActions(List<Action> actions)
            throws JsonGenerationException, IOException {
        List<String> actionStrings = new ArrayList<String>();

        for (Action action : actions) {
            actionStrings.add(action.getActionName());
        }
        writeJsonArray(JsonDocumentFields.ACTION, actionStrings);
    }
1220503
public void write( IGeneratorSet generatorSet)
    {
    writer_.writeDeclaration();

    writer_
      .element( GENERATORS_TAG)
      .content( () ->
        {
        Arrays.stream( generatorSet.getGeneratorFunctions())
          .sorted()
          .forEach( function -> writeGenerator( function, generatorSet.getGenerator( function)));
        })
      .write();
    }
644738
public static void exportJson(JsonWriter writer, Resource resource)
            throws RepositoryException, IOException {
        exportJson(writer, resource, MappingRules.getDefaultMappingRules());
    }
428945
public void setResources(Resource[] resources) throws IOException {
        clear();
        
        for (Resource resource : resources) {
            addResource(resource);
        }
    }
734116
public static void writeGenerators( IGeneratorSet generators, OutputStream outputStream)
    {
    try( GeneratorSetJsonWriter writer = new GeneratorSetJsonWriter( outputStream))
      {
      writer.write( generators);
      }
    catch( Exception e)
      {
      throw new RuntimeException( "Can't write generator definitions", e);
      }
    }
1024499
public void setResourceServers(java.util.Collection<ResourceServerType> resourceServers) {
        if (resourceServers == null) {
            this.resourceServers = null;
            return;
        }

        this.resourceServers = new java.util.ArrayList<ResourceServerType>(resourceServers);
    }
693362
public void write(JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStartObject();

    int totalSessionsToCtx = 0, totalDeletedSessions = 0;
    for (int i = 0; i < numNotifierThreads; i++) {
      totalSessionsToCtx += notifierThreads[i].sessionsToCtx.size();
      totalDeletedSessions += notifierThreads[i].deletedSessions.size();
    }

    jsonGenerator.writeNumberField("totalSessionsToCtx",
                                    totalSessionsToCtx);

    jsonGenerator.writeFieldName("sessionsToCtx");
    jsonGenerator.writeStartObject();
    for (int i = 0; i < numNotifierThreads; i++) {
      for (ConcurrentMap.Entry<String, SessionNotificationCtx> entry :
        notifierThreads[i].sessionsToCtx.entrySet()) {
        jsonGenerator.writeFieldName(entry.getKey());
        entry.getValue().write(jsonGenerator);
      }
    }
    jsonGenerator.writeEndObject();

    jsonGenerator.writeNumberField("totalDeletedSessions",
                                    totalDeletedSessions);

    jsonGenerator.writeFieldName("deletedSessions");
    jsonGenerator.writeStartArray();
    for (int i = 0; i < numNotifierThreads; i++) {
      for (String deletedSessionHandle :
            notifierThreads[i].deletedSessions.keySet()) {
        jsonGenerator.writeString(deletedSessionHandle);
      }
    }
    jsonGenerator.writeEndArray();

    jsonGenerator.writeEndObject();
  }
53596
public static void writeResource(final Resource.Writable resource,
                                     final CharSequence content) throws IOException {
        resource.useWriter(writer -> IOUtils.write(content.toString(), writer));
    }
813148
public static void copyResource(String resource, File destination) throws IOException {
        InputStream is = null;
        FileOutputStream fos = null;

        try {
            is = FileUtils.class.getResourceAsStream("/" + resource);
            fos = new FileOutputStream(destination);

            final byte[] buffer = new byte[10 * 1024];
            int len;
            while ((len = is.read(buffer)) > 0) {
                fos.write(buffer, 0, len);
            }
        } finally {
            close(is);
            close(fos);
        }

    }
311929
public void setResourceChanges(java.util.Collection<ResourceChange> resourceChanges) {
        if (resourceChanges == null) {
            this.resourceChanges = null;
            return;
        }

        this.resourceChanges = new java.util.ArrayList<ResourceChange>(resourceChanges);
    }
599879
def write_resources(self, resources):
        
        for filename, data in list(resources.get('outputs', {}).items()):
            # Determine where to write the file to
            dest = os.path.join(self.output_dir, filename)
            path = os.path.dirname(dest)
            if path and not os.path.isdir(path):
                os.makedirs(path)

            # Write file
            with open(dest, 'wb') as f:
                f.write(data)
280116
public static void destroy(final Resource... resources)
  {
    for (Resource r : resources) {
      if (r != null) {
        r.destroy();
      }
    }
  }