java.lang.Object
io.jenetics.xml.Writers.LongChromosome
- Enclosing class:
Writers
This class contains static writer methods for
XML output
LongChromosome
objects.
Writer code
final LongChromosome value = LongChromosome
.of(Long.MIN_VALUE, Long.MAX_VALUE, 3);
try (AutoCloseableXMLStreamWriter xml = XML.writer(System.out, " ")) {
Writers.LongChromosome.writer().write(value, xml);
}
<long-chromosome length="3">
<min>-9223372036854775808</min>
<max>9223372036854775807</max>
<alleles>
<allele>-1345217698116542402</allele>
<allele>-7144755673073475303</allele>
<allele>6053786736809578435</allele>
</alleles>
</long-chromosome>
-
Method Summary
Modifier and TypeMethodDescriptionReturn the default long-allele writer for theIntegerChromosome
.static void
write
(OutputStream out, LongChromosome data) Write the givenLongChromosome
to the given output stream.static void
write
(OutputStream out, LongChromosome data, String indent) Write the givenLongChromosome
to the given output stream.static Writer
<LongChromosome> writer()
Return aWriter
forLongChromosome
objects.static Writer
<LongChromosome> Return aWriter
forLongChromosome
objects.
-
Method Details
-
alleleWriter
Return the default long-allele writer for theIntegerChromosome
.- Returns:
- the default long-allele writer
-
writer
Return aWriter
forLongChromosome
objects.- Parameters:
alleleWriter
- the allele writer used for writing the long allele. Might be useful for using different long encodings.- Returns:
- a chromosome writer
- Throws:
NullPointerException
- if the givenalleleWriter
isnull
-
writer
Return aWriter
forLongChromosome
objects.- Returns:
- a chromosome writer
-
write
public static void write(OutputStream out, LongChromosome data, String indent) throws XMLStreamException Write the givenLongChromosome
to the given output stream.- Parameters:
out
- the target output streamdata
- the chromosome to writeindent
- the XML level indentation- Throws:
XMLStreamException
- if an error occurs while writing the chromosomeNullPointerException
- if thechromosome
or output stream isnull
-
write
Write the givenLongChromosome
to the given output stream.- Parameters:
out
- the target output streamdata
- the chromosome to write- Throws:
XMLStreamException
- if an error occurs while writing the chromosomeNullPointerException
- if thechromosome
or output stream isnull
-