Package io.jenetics.xml
Class Writers
- java.lang.Object
-
- io.jenetics.xml.Writers
-
public final class Writers extends Object
This class contains static fields and methods, for creating chromosome- and genotype writers for different gene types.This class also contains some helper methods, which makes it easier to write Jenetics domain objects to a given output stream.final Writer<Genotype<BitGene> bgw = Writers.Genotype.writer(Writers.BitChromosome.writer())); final Writer<Genotype<IntegerGene>> igw = Writers.Genotype.writer(Writers.IntegerChromosome.writer())); final Writer<Genotype<DoubleGene>> dgw = Writers.Genotype.writer(Writers.DoubleChromosome.writer()));final List<Genotype<BitGene>> genotypes = ...; try (OutputStream out = Files.newOutputStream(Paths.get("path"))) { Writers.write(out, genotypes, Writers.BitChromosome.writer()); }- Since:
- 3.9
- Version:
- 3.9
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWriters.BitChromosomeThis class contains static writer methods forBitChromosomeobjects.static classWriters.BoundedChromosomeThis class contains static writer methods forBoundedChromosomeobjects.static classWriters.CharacterChromosomeThis class contains static writer methods forCharacterChromosomeobjects.static classWriters.DoubleChromosomeThis class contains static writer methods forDoubleChromosomeobjects.static classWriters.GenotypeThis class contains static writer methods forGenotypeobjects.static classWriters.GenotypesThis class contains static writer methods forGenotypeobjects.static classWriters.IntegerChromosomeThis class contains static writer methods forIntegerChromosomeobjects.static classWriters.LongChromosomeThis class contains static writer methods forLongChromosomeobjects.static classWriters.PermutationChromosomeThis class contains static writer methods forPermutationChromosomeobjects.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A,G extends Gene<A,G>,C extends Chromosome<G>>
voidwrite(OutputStream out, Collection<Genotype<G>> data, Writer<? super C> chromosomeWriter)Write the givenGenotypeto the given output stream.
-
-
-
Method Detail
-
write
public static <A,G extends Gene<A,G>,C extends Chromosome<G>> void write(OutputStream out, Collection<Genotype<G>> data, Writer<? super C> chromosomeWriter) throws XMLStreamException
Write the givenGenotypeto the given output stream.- Type Parameters:
A- the allele typeG- the gene typeC- the chromosome type- Parameters:
out- the target output streamdata- the genotypes to writechromosomeWriter- the chromosome writer used to write the genotypes- Throws:
XMLStreamException- if an error occurs while writing the chromosomeNullPointerException- if the one of the arguments isnull- See Also:
Writers.Genotypes.write(OutputStream, Collection, Writer)
-
-