Class DynamicFile

java.lang.Object
org.springframework.core.test.tools.DynamicFile
Direct Known Subclasses:
ResourceFile, SourceFile

public abstract sealed class DynamicFile extends Object permits SourceFile, ResourceFile
Abstract base class for dynamically generated files.
Since:
6.0
Author:
Phillip Webb
See Also:
  • Constructor Details

    • DynamicFile

      protected DynamicFile(String path, String content)
  • Method Details

    • toString

      protected static String toString(WritableContent writableContent)
    • getBytes

      public byte[] getBytes()
      Return the contents of the file as a byte array.
      Returns:
      the file contents as a byte array
    • getContent

      public String getContent()
      Return the contents of the file.
      Returns:
      the file contents
    • getPath

      public String getPath()
      Return the relative path of the file.
      Returns:
      the file path
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object