Class AbstractTextBoundaryWriteHandler3D
- java.lang.Object
-
- org.apache.commons.geometry.io.euclidean.threed.AbstractBoundaryWriteHandler3D
-
- org.apache.commons.geometry.io.euclidean.threed.txt.AbstractTextBoundaryWriteHandler3D
-
- All Implemented Interfaces:
BoundaryWriteHandler<PlaneConvexSubset,BoundarySource3D>
,BoundaryWriteHandler3D
- Direct Known Subclasses:
CsvBoundaryWriteHandler3D
,TextBoundaryWriteHandler3D
public abstract class AbstractTextBoundaryWriteHandler3D extends AbstractBoundaryWriteHandler3D
Abstract based class for write handlers that output text formats produced byTextFacetDefinitionWriter
.- See Also:
TextFacetDefinitionWriter
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DEFAULT_LINE_SEPARATOR
The default line separator value.private java.nio.charset.Charset
defaultCharset
Default charset used for text output.private java.util.function.DoubleFunction<java.lang.String>
doubleFormat
Double format function.private java.lang.String
lineSeparator
Line separator string.
-
Constructor Summary
Constructors Constructor Description AbstractTextBoundaryWriteHandler3D()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.charset.Charset
getDefaultCharset()
Get the text output default charset, used if the output does not specify a charset.java.util.function.DoubleFunction<java.lang.String>
getDoubleFormat()
Get the double format function used to convert double values to strings.protected TextFacetDefinitionWriter
getFacetDefinitionWriter(GeometryOutput out)
Get a configuredTextFacetDefinitionWriter
for writing output.java.lang.String
getLineSeparator()
Get the line separator.void
setDefaultCharset(java.nio.charset.Charset defaultCharset)
Set the text output default charset, used if the output does not specify a charset.void
setDoubleFormat(java.util.function.DoubleFunction<java.lang.String> doubleFormat)
Set the double format function used to convert double values to strings.void
setLineSeparator(java.lang.String lineSeparator)
Set the line separator.void
write(java.util.stream.Stream<? extends PlaneConvexSubset> boundaries, GeometryOutput out)
Write all boundaries in the stream to the given output using the data format supported by this instance.void
writeFacets(java.util.stream.Stream<? extends FacetDefinition> facets, GeometryOutput out)
Write allfacets
in the stream to the output using the data format supported by this instance.-
Methods inherited from class org.apache.commons.geometry.io.euclidean.threed.AbstractBoundaryWriteHandler3D
write, writeFacets
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.geometry.io.core.BoundaryWriteHandler
getFormat
-
-
-
-
Field Detail
-
DEFAULT_LINE_SEPARATOR
private static final java.lang.String DEFAULT_LINE_SEPARATOR
The default line separator value.- See Also:
- Constant Field Values
-
defaultCharset
private java.nio.charset.Charset defaultCharset
Default charset used for text output.
-
lineSeparator
private java.lang.String lineSeparator
Line separator string.
-
doubleFormat
private java.util.function.DoubleFunction<java.lang.String> doubleFormat
Double format function.
-
-
Method Detail
-
getDefaultCharset
public java.nio.charset.Charset getDefaultCharset()
Get the text output default charset, used if the output does not specify a charset.- Returns:
- text output default charset
-
setDefaultCharset
public void setDefaultCharset(java.nio.charset.Charset defaultCharset)
Set the text output default charset, used if the output does not specify a charset.- Parameters:
defaultCharset
- text output default charset
-
getLineSeparator
public java.lang.String getLineSeparator()
Get the line separator. This value defaults to "\n".- Returns:
- the current line separator
-
setLineSeparator
public void setLineSeparator(java.lang.String lineSeparator)
Set the line separator.- Parameters:
lineSeparator
- the line separator to use
-
getDoubleFormat
public java.util.function.DoubleFunction<java.lang.String> getDoubleFormat()
Get the double format function used to convert double values to strings.- Returns:
- double format function
-
setDoubleFormat
public void setDoubleFormat(java.util.function.DoubleFunction<java.lang.String> doubleFormat)
Set the double format function used to convert double values to strings. The given function must be thread-safe if this handler is to be used in a multi-threaded context.- Parameters:
doubleFormat
- double format function
-
write
public void write(java.util.stream.Stream<? extends PlaneConvexSubset> boundaries, GeometryOutput out)
Write all boundaries in the stream to the given output using the data format supported by this instance. The stream passed as an argument is not closed, meaning that callers are responsible for closing the stream if necessary (for example, if the stream fetches data from the file system).- Parameters:
boundaries
- stream containing boundaries to writeout
- output to write to
-
writeFacets
public void writeFacets(java.util.stream.Stream<? extends FacetDefinition> facets, GeometryOutput out)
Write allfacets
in the stream to the output using the data format supported by this instance. The stream passed as an argument is not closed, meaning that callers are responsible for closing the stream if necessary (for example, if the stream fetches data from the file system).- Parameters:
facets
- stream containing facets to writeout
- output to write to
-
getFacetDefinitionWriter
protected TextFacetDefinitionWriter getFacetDefinitionWriter(GeometryOutput out)
Get a configuredTextFacetDefinitionWriter
for writing output.- Parameters:
out
- output stream to write to- Returns:
- a new, configured text format writer
- Throws:
java.io.UncheckedIOException
- if an I/O error occurs
-
-