Class ResourceUtils

java.lang.Object
pro.verron.officestamper.test.utils.ResourceUtils

public class ResourceUtils extends Object
A utility class for testing. Provides methods for retrieving InputStreams from specified resource paths. Typically used for accessing test resources.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Image
    getImage(Path path)
    Retrieves an image from the specified resource path.
    static Image
    getImage(Path path, @Nullable Integer size)
    Retrieves an image from the specified resource path.
    static org.docx4j.openpackaging.packages.PresentationMLPackage
    Retrieves a PresentationMLPackage from the specified resource path.
    Retrieves an InputStream for the specified resource path.
    static org.docx4j.openpackaging.packages.WordprocessingMLPackage
    Retrieves a WordprocessingMLPackage from the specified resource path.
    static org.docx4j.openpackaging.packages.WordprocessingMLPackage
    Retrieves a WordprocessingMLPackage from the specified resource path.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResourceUtils

      public ResourceUtils()
      Default constructor.
  • Method Details

    • getImage

      public static Image getImage(Path path)
      Retrieves an image from the specified resource path.
      Parameters:
      path - the path of the resource
      Returns:
      an image for the specified resource
    • getImage

      public static Image getImage(Path path, @Nullable Integer size)
      Retrieves an image from the specified resource path.
      Parameters:
      path - the path of the resource
      size - the size of the image
      Returns:
      an image for the specified resource
    • getResource

      public static InputStream getResource(Path path)
      Retrieves an InputStream for the specified resource path.
      Parameters:
      path - the path of the resource
      Returns:
      an InputStream for the specified resource
    • getWordResource

      public static org.docx4j.openpackaging.packages.WordprocessingMLPackage getWordResource(String path)
      Retrieves a WordprocessingMLPackage from the specified resource path.
      Parameters:
      path - the path of the resource
      Returns:
      a WordprocessingMLPackage for the specified resource
    • getWordResource

      public static org.docx4j.openpackaging.packages.WordprocessingMLPackage getWordResource(Path path)
      Retrieves a WordprocessingMLPackage from the specified resource path.
      Parameters:
      path - the path of the resource
      Returns:
      a WordprocessingMLPackage for the specified resource
    • getPowerPointResource

      public static org.docx4j.openpackaging.packages.PresentationMLPackage getPowerPointResource(Path path)
      Retrieves a PresentationMLPackage from the specified resource path.
      Parameters:
      path - the path of the resource
      Returns:
      a PresentationMLPackage for the specified resource