Class FileContentInfo
java.lang.Object
io.github.astrapi69.file.create.model.FileInfo
io.github.astrapi69.file.create.model.FileContentInfo
The class
FileContentInfo
represents information about file content, including checksum
and binary data.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
FileContentInfo.FileContentInfoBuilder<C extends FileContentInfo,
B extends FileContentInfo.FileContentInfoBuilder<C, B>> The builder class for constructing `FileContentInfo` objects.Nested classes/interfaces inherited from class io.github.astrapi69.file.create.model.FileInfo
FileInfo.FileInfoBuilder<C extends FileInfo,
B extends FileInfo.FileInfoBuilder<C, B>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs a new empty `FileContentInfo`.protected
Constructs a new `FileContentInfo` from the builder.FileContentInfo
(String checksum, byte[] content) Constructs a new `FileContentInfo` with the given checksum and content. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileContentInfo.FileContentInfoBuilder<?,
?> builder()
Returns a builder for constructing `FileContentInfo` objects.protected boolean
Internal method for checking equality with another object.boolean
Indicates whether some other object is "equal to" this one.Retrieves the checksum of the file content.byte[]
Retrieves the binary content of the file.int
hashCode()
Returns a hash code value for the object.void
setChecksum
(String checksum) Sets the checksum of the file content.void
setContent
(byte[] content) Sets the binary content of the file.static File
toFile
(FileContentInfo fileContentInfo) Converts a `FileContentInfo` into a `File`.static FileContentInfo
toFileContentInfo
(File file) Converts a `File` into a `FileContentInfo`, extracting its name, path, checksum, and content.toString()
Returns a string representation of the object.Methods inherited from class io.github.astrapi69.file.create.model.FileInfo
getName, getPath, isDirectory, setDirectory, setName, setPath, toBuilder, toFile, toFile, toFileInfo
-
Constructor Details
-
FileContentInfo
Constructs a new `FileContentInfo` with the given checksum and content.- Parameters:
checksum
- the checksum of the file contentcontent
- the binary content of the file
-
FileContentInfo
public FileContentInfo()Constructs a new empty `FileContentInfo`. -
FileContentInfo
Constructs a new `FileContentInfo` from the builder.- Parameters:
b
- the builder used to construct the `FileContentInfo`
-
-
Method Details
-
toFileContentInfo
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
Converts a `FileContentInfo` into a `File`.- Parameters:
fileContentInfo
- the `FileContentInfo` to convert- Returns:
- the `File` representation of the `FileContentInfo`
-
builder
Returns a builder for constructing `FileContentInfo` objects.- Returns:
- a new instance of `FileContentInfoBuilder`
-
getChecksum
Retrieves the checksum of the file content.- Returns:
- the checksum of the file content
-
setChecksum
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
Indicates whether some other object is "equal to" this one. -
canEqual
Internal method for checking equality with another object. -
hashCode
public int hashCode()Returns a hash code value for the object. -
toString
Returns a string representation of the object.
-