java.lang.Object
io.github.astrapi69.file.create.model.FileInfo
io.github.astrapi69.file.create.model.FileContentInfo

public class FileContentInfo extends FileInfo
The class FileContentInfo represents information about file content, including checksum and binary data.
  • Constructor Details

    • FileContentInfo

      public FileContentInfo(String checksum, byte[] content)
      Constructs a new `FileContentInfo` with the given checksum and content.
      Parameters:
      checksum - the checksum of the file content
      content - the binary content of the file
    • FileContentInfo

      public FileContentInfo()
      Constructs a new empty `FileContentInfo`.
    • FileContentInfo

      protected FileContentInfo(FileContentInfo.FileContentInfoBuilder<?,?> b)
      Constructs a new `FileContentInfo` from the builder.
      Parameters:
      b - the builder used to construct the `FileContentInfo`
  • Method Details

    • toFileContentInfo

      public static FileContentInfo toFileContentInfo(File file)
      Converts a `File` into a `FileContentInfo`, extracting its name, path, checksum, and content.
      Parameters:
      file - the file to convert
      Returns:
      the `FileContentInfo` representation of the file
    • toFile

      public static File toFile(FileContentInfo fileContentInfo)
      Converts a `FileContentInfo` into a `File`.
      Parameters:
      fileContentInfo - the `FileContentInfo` to convert
      Returns:
      the `File` representation of the `FileContentInfo`
    • builder

      public static FileContentInfo.FileContentInfoBuilder<?,?> builder()
      Returns a builder for constructing `FileContentInfo` objects.
      Returns:
      a new instance of `FileContentInfoBuilder`
    • getChecksum

      public String getChecksum()
      Retrieves the checksum of the file content.
      Returns:
      the checksum of the file content
    • setChecksum

      public void setChecksum(String checksum)
      Sets the checksum of the file content.
      Parameters:
      checksum - the new checksum to set
    • getContent

      public byte[] getContent()
      Retrieves the binary content of the file.
      Returns:
      the binary content of the file
    • setContent

      public void setContent(byte[] content)
      Sets the binary content of the file.
      Parameters:
      content - the new binary content to set
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one.
      Overrides:
      equals in class FileInfo
      Parameters:
      o - the object to compare
      Returns:
      true if this object is the same as the o argument; false otherwise
    • canEqual

      protected boolean canEqual(Object other)
      Internal method for checking equality with another object.
      Overrides:
      canEqual in class FileInfo
      Parameters:
      other - the object to compare with
      Returns:
      true if the objects can be considered equal, false otherwise
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class FileInfo
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class FileInfo
      Returns:
      a string representation of the object