Interface BoundaryReadHandler<H extends HyperplaneConvexSubset<?>,​B extends BoundarySource<H>>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.stream.Stream<H> boundaries​(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a Stream that can be used to access all boundary information from the given input, which is expected to contain data in the format supported by this handler.
      GeometryFormat getFormat()
      Get the data format supported by this handler.
      B read​(GeometryInput input, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return an object containing all boundaries read from input using the handler's supported data format.
    • Method Detail

      • getFormat

        GeometryFormat getFormat()
        Get the data format supported by this handler.
        Returns:
        data format supported by this handler
      • read

        B read​(GeometryInput input,
               org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return an object containing all boundaries read from input using the handler's supported data format.
        Parameters:
        input - input to read from
        precision - precision context used for floating point comparisons
        Returns:
        object containing all boundaries read from input
        Throws:
        java.lang.IllegalArgumentException - if mathematically invalid data is encountered
        java.lang.IllegalStateException - if a data format error occurs
        java.io.UncheckedIOException - if an I/O error occurs
      • boundaries

        java.util.stream.Stream<H> boundaries​(GeometryInput in,
                                              org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
        Return a Stream that can be used to access all boundary information from the given input, which is expected to contain data in the format supported by this handler. Unlike the read method, this method does not require that all input be read immediately and stored in memory (although implementations of this interface are still free to do so). Callers may therefore prefer to use this method in cases where memory usage is a concern or transformations and/or filters must be applied to the boundaries before use.

        Implementing class will usually keep the source input stream open during stream iteration. Callers should therefore use the returned stream in a try-with-resources statement to ensure that all resources are properly released. Ex:

          try (Stream<H> stream = handler.boundaries(in, precision)) {
              // access stream content
          }
         

        The following exceptions may be thrown during stream iteration:

        • IllegalArgumentException if mathematically invalid data is encountered
        • IllegalStateException if a data format error occurs
        • UncheckedIOException if an I/O error occurs
        Parameters:
        in - input to read from
        precision - precision context used for floating point comparisons
        Returns:
        stream providing access to the boundary information from the given input
        Throws:
        java.lang.IllegalStateException - if a data format error occurs during stream creation
        java.io.UncheckedIOException - if an I/O error occurs during stream creation