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.
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()));
This class also contains some helper methods, which makes it easier to write Jenetics domain objects to a given output stream.
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