Class BinaryStlFacetDefinitionReader

java.lang.Object
org.apache.commons.geometry.io.euclidean.threed.stl.BinaryStlFacetDefinitionReader
All Implemented Interfaces:
AutoCloseable, FacetDefinitionReader

Class used to read the binary form of the STL file format.
See Also:
  • Constructor Details

  • Method Details

    • getHeader

      Get a read-only buffer containing the 80 bytes of the STL header. The header does not include the 4-byte value indicating the total number of triangles in the STL file.
      Returns:
      the STL header content
      Throws:
      UncheckedIOException - if an I/O error occurs
    • getHeaderAsString

      Return the header content as a string decoded using the UTF-8 charset. Control characters (such as '\0') are not included in the result.
      Returns:
      the header content decoded as a UTF-8 string
      Throws:
      UncheckedIOException - if an I/O error occurs
    • getHeaderAsString

      public String getHeaderAsString(Charset charset)
      Return the header content as a string decoded using the given charset. Control characters (such as '\0') are not included in the result.
      Parameters:
      charset - charset to decode the header with
      Returns:
      the header content decoded as a string
      Throws:
      UncheckedIOException - if an I/O error occurs
    • getNumTriangles

      public long getNumTriangles()
      Get the total number of triangles (i.e. facets) declared to be present in the input.
      Returns:
      total number of triangle in the input
      Throws:
      UncheckedIOException - if an I/O error occurs
    • readFacet

      Return the next facet definition from the input source or null if no more facets are available.
      Specified by:
      readFacet in interface FacetDefinitionReader
      Returns:
      the next facet definition or null if no more facets are available
    • close

      public void close()
      Close this instance and release all associated resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface FacetDefinitionReader