Class File
java.lang.Object
security.whisper.javastix.coo.objects.File
- All Implemented Interfaces:
Serializable,BundleableObject,Stix,StixCustomProperties,CyberObservableObject,CyberObservableObjectCommonProperties,FileCoo,GenericValidation,SdoDefaultValidator
@ParametersAreNonnullByDefault
@Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class File
extends Object
implements FileCoo
file
The File Object represents the properties of a file.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface security.whisper.javastix.validation.SdoDefaultValidator
VALIDATOR -
Method Summary
Modifier and TypeMethodDescriptionstatic File.Builderbuilder()Creates a builder forFile.static FileCreates an immutable copy of aFileCoovalue.booleanThis instance is equal to all instances ofFilethat have equal attribute values.Custom Properties for STIX Objects.Indicates whether the data contained in the SCO has been defanged.com.google.common.collect.ImmutableSet<CyberObservableExtension> Multiple extensions can be added, but only 1 instance of a specific extension can be added.com.google.common.collect.ImmutableSet<GranularMarkingDm> booleangetId()Deterministically generates the ID for this file based on its hashes and name.getName()com.google.common.collect.ImmutableSet<MarkingDefinitionDm> Used for generation of Map Keys byManually set this value if you want to control key names.invalid reference
ObservedDataSdo#getObjects()getSize()getType()inthashCode()Computes a hash code from attributes:hashes,size,name,nameEnc,magicNumberHex,mimeType,created,modified,accessed,parentDirectoryRef,isEncrypted,encryptionAlgorithm,decryptionKey,contentRef,id,type,extensions,observableObjectKey,defanged,customProperties,objectMarkingRefs,granularMarkings,hydrated,toJsonString.toString()Prints the immutable valueFilewith attribute values.final FilewithAccessed(Optional<? extends StixInstant> optional) Copy the current immutable object by setting an optional value for theaccessedattribute.final FilewithAccessed(StixInstant value) Copy the current immutable object by setting a present value for the optionalaccessedattribute.final FilewithContentRef(String value) Copy the current immutable object by setting a present value for the optionalcontentRefattribute.final FilewithContentRef(Optional<String> optional) Copy the current immutable object by setting an optional value for thecontentRefattribute.final FilewithCreated(Optional<? extends StixInstant> optional) Copy the current immutable object by setting an optional value for thecreatedattribute.final FilewithCreated(StixInstant value) Copy the current immutable object by setting a present value for the optionalcreatedattribute.final FilewithCustomProperties(Map<String, ? extends Object> entries) Copy the current immutable object by replacing thecustomPropertiesmap with the specified map.final FilewithDecryptionKey(String value) Copy the current immutable object by setting a present value for the optionaldecryptionKeyattribute.final FilewithDecryptionKey(Optional<String> optional) Copy the current immutable object by setting an optional value for thedecryptionKeyattribute.final FilewithDefanged(boolean value) Copy the current immutable object by setting a present value for the optionaldefangedattribute.final FilewithDefanged(Optional<Boolean> optional) Copy the current immutable object by setting an optional value for thedefangedattribute.final FilewithEncryptionAlgorithm(String value) Copy the current immutable object by setting a present value for the optionalencryptionAlgorithmattribute.final FilewithEncryptionAlgorithm(Optional<String> optional) Copy the current immutable object by setting an optional value for theencryptionAlgorithmattribute.final FilewithExtensions(Iterable<? extends CyberObservableExtension> elements) Copy the current immutable object with elements that replace the content ofextensions.final FilewithExtensions(CyberObservableExtension... elements) Copy the current immutable object with elements that replace the content ofextensions.final FilewithGranularMarkings(Iterable<? extends GranularMarkingDm> elements) Copy the current immutable object with elements that replace the content ofgranularMarkings.final FilewithGranularMarkings(GranularMarkingDm... elements) Copy the current immutable object with elements that replace the content ofgranularMarkings.final FilewithHashes(Map<String, ? extends String> entries) Copy the current immutable object by replacing thehashesmap with the specified map.final FilewithHydrated(boolean value) Copy the current immutable object by setting a value for thehydratedattribute.final FilewithIsEncrypted(boolean value) Copy the current immutable object by setting a present value for the optionalisEncryptedattribute.final FilewithIsEncrypted(Optional<Boolean> optional) Copy the current immutable object by setting an optional value for theisEncryptedattribute.final FilewithMagicNumberHex(String value) Copy the current immutable object by setting a present value for the optionalmagicNumberHexattribute.final FilewithMagicNumberHex(Optional<String> optional) Copy the current immutable object by setting an optional value for themagicNumberHexattribute.final FilewithMimeType(String value) Copy the current immutable object by setting a present value for the optionalmimeTypeattribute.final FilewithMimeType(Optional<String> optional) Copy the current immutable object by setting an optional value for themimeTypeattribute.final FilewithModified(Optional<? extends StixInstant> optional) Copy the current immutable object by setting an optional value for themodifiedattribute.final FilewithModified(StixInstant value) Copy the current immutable object by setting a present value for the optionalmodifiedattribute.final FileCopy the current immutable object by setting a present value for the optionalnameattribute.final FileCopy the current immutable object by setting an optional value for thenameattribute.final FilewithNameEnc(String value) Copy the current immutable object by setting a present value for the optionalnameEncattribute.final FilewithNameEnc(Optional<String> optional) Copy the current immutable object by setting an optional value for thenameEncattribute.final FilewithObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements) Copy the current immutable object with elements that replace the content ofobjectMarkingRefs.final FilewithObjectMarkingRefs(MarkingDefinitionDm... elements) Copy the current immutable object with elements that replace the content ofobjectMarkingRefs.final FilewithObservableObjectKey(String value) Copy the current immutable object by setting a value for theobservableObjectKeyattribute.final FilewithParentDirectoryRef(String value) Copy the current immutable object by setting a present value for the optionalparentDirectoryRefattribute.final FilewithParentDirectoryRef(Optional<String> optional) Copy the current immutable object by setting an optional value for theparentDirectoryRefattribute.final FilewithSize(long value) Copy the current immutable object by setting a present value for the optionalsizeattribute.final FileCopy the current immutable object by setting an optional value for thesizeattribute.final FilewithToJsonString(String value) Copy the current immutable object by setting a value for thetoJsonStringattribute.final FileCopy the current immutable object by setting a value for thetypeattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface security.whisper.javastix.coo.objects.FileCoo
getContainsRefsMethods inherited from interface security.whisper.javastix.validation.GenericValidation
validateEntityMethods inherited from interface security.whisper.javastix.validation.SdoDefaultValidator
validate, validateOnlyId
-
Method Details
-
getHashes
-
getSize
-
getName
-
getNameEnc
@JsonPropertyDescription("Specifies the observed encoding for the name of the file.") public Optional<String> getNameEnc()- Specified by:
getNameEncin interfaceFileCoo- Returns:
- The value of the
nameEncattribute
-
getMagicNumberHex
@JsonPropertyDescription("Specifies the hexadecimal constant (\'magic number\') associated with a specific file format that corresponds to the file, if applicable.") public Optional<String> getMagicNumberHex()- Specified by:
getMagicNumberHexin interfaceFileCoo- Returns:
- The value of the
magicNumberHexattribute
-
getMimeType
@JsonPropertyDescription("Specifies the MIME type name specified for the file, e.g., \'application/msword\'.") public Optional<String> getMimeType()- Specified by:
getMimeTypein interfaceFileCoo- Returns:
- The value of the
mimeTypeattribute
-
getCreated
@JsonPropertyDescription("Specifies the date/time the file was created.") public Optional<StixInstant> getCreated()- Specified by:
getCreatedin interfaceFileCoo- Returns:
- The value of the
createdattribute
-
getModified
@JsonPropertyDescription("Specifies the date/time the file was last written to/modified.") public Optional<StixInstant> getModified()- Specified by:
getModifiedin interfaceFileCoo- Returns:
- The value of the
modifiedattribute
-
getAccessed
@JsonPropertyDescription("Specifies the date/time the file was last accessed.") public Optional<StixInstant> getAccessed()- Specified by:
getAccessedin interfaceFileCoo- Returns:
- The value of the
accessedattribute
-
getParentDirectoryRef
@JsonPropertyDescription("Specifies the parent directory of the file, as a reference to a Directory Object.") public Optional<String> getParentDirectoryRef()- Specified by:
getParentDirectoryRefin interfaceFileCoo- Returns:
- The value of the
parentDirectoryRefattribute
-
isEncrypted
@JsonPropertyDescription("Specifies whether the file is encrypted.") public Optional<Boolean> isEncrypted()- Specified by:
isEncryptedin interfaceFileCoo- Returns:
- The value of the
isEncryptedattribute
-
getEncryptionAlgorithm
@JsonPropertyDescription("Specifies the name of the encryption algorithm used to encrypt the file. Open Vocabulary - encryption-algorithm-ov") public Optional<String> getEncryptionAlgorithm()- Specified by:
getEncryptionAlgorithmin interfaceFileCoo- Returns:
- The value of the
encryptionAlgorithmattribute
-
getDecryptionKey
@JsonPropertyDescription("Specifies the decryption key used to decrypt the archive file.") public Optional<String> getDecryptionKey()- Specified by:
getDecryptionKeyin interfaceFileCoo- Returns:
- The value of the
decryptionKeyattribute
-
getContentRef
@JsonPropertyDescription("Specifies the content of the file, represented as an Artifact Object.") public Optional<String> getContentRef()- Specified by:
getContentRefin interfaceFileCoo- Returns:
- The value of the
contentRefattribute
-
getId
Deterministically generates the ID for this file based on its hashes and name. Uses the first available hash from the hashes map, or the file name if no hashes are present.- Specified by:
getIdin interfaceBundleableObject- Specified by:
getIdin interfaceCyberObservableObjectCommonProperties- Specified by:
getIdin interfaceFileCoo
-
getType
- Specified by:
getTypein interfaceBundleableObject- Specified by:
getTypein interfaceCyberObservableObjectCommonProperties- Returns:
- The value of the
typeattribute
-
getExtensions
@JsonPropertyDescription("Specifies any extensions of the object, as a dictionary.") public com.google.common.collect.ImmutableSet<CyberObservableExtension> getExtensions()Multiple extensions can be added, but only 1 instance of a specific extension can be added.- Specified by:
getExtensionsin interfaceCyberObservableObjectCommonProperties
-
getObservableObjectKey
Used for generation of Map Keys byManually set this value if you want to control key names. Otherwise UUIDs will be used.invalid reference
ObservedDataSdo#getObjects()- Specified by:
getObservableObjectKeyin interfaceCyberObservableObjectCommonProperties
-
getDefanged
@JsonPropertyDescription("Indicates whether the data contained in the SCO has been defanged.") public Optional<Boolean> getDefanged()Indicates whether the data contained in the SCO has been defanged. Defanging refers to the process of modifying data to make it safe to handle (e.g., changing an IP address from 192.168.1.1 to 192[.]168[.]1[.]1).- Specified by:
getDefangedin interfaceCyberObservableObjectCommonProperties
-
getCustomProperties
Custom Properties for STIX Objects. Any object that supports custom properties will have a validation of the custom property prefix (typically "x_"). If the additional property in the JSON does not meet the StartsWith condition, then the JSON will be rejected.- Specified by:
getCustomPropertiesin interfaceStixCustomProperties- Returns:
- Map of custom properties
Map<String, Object>
-
getObjectMarkingRefs
- Specified by:
getObjectMarkingRefsin interfaceBundleableObject- Returns:
- The value of the
objectMarkingRefsattribute
-
getGranularMarkings
- Specified by:
getGranularMarkingsin interfaceBundleableObject- Returns:
- The value of the
granularMarkingsattribute
-
getHydrated
public boolean getHydrated()- Specified by:
getHydratedin interfaceBundleableObject- Returns:
- The value of the
hydratedattribute
-
toJsonString
- Specified by:
toJsonStringin interfaceBundleableObject- Returns:
- The value of the
toJsonStringattribute
-
withHashes
Copy the current immutable object by replacing thehashesmap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the hashes map- Returns:
- A modified copy of
thisobject
-
withSize
Copy the current immutable object by setting a present value for the optionalsizeattribute.- Parameters:
value- The value for size- Returns:
- A modified copy of
thisobject
-
withSize
Copy the current immutable object by setting an optional value for thesizeattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for size- Returns:
- A modified copy of
thisobject
-
withName
Copy the current immutable object by setting a present value for the optionalnameattribute.- Parameters:
value- The value for name- Returns:
- A modified copy of
thisobject
-
withName
Copy the current immutable object by setting an optional value for thenameattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for name- Returns:
- A modified copy of
thisobject
-
withNameEnc
Copy the current immutable object by setting a present value for the optionalnameEncattribute.- Parameters:
value- The value for nameEnc- Returns:
- A modified copy of
thisobject
-
withNameEnc
Copy the current immutable object by setting an optional value for thenameEncattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for nameEnc- Returns:
- A modified copy of
thisobject
-
withMagicNumberHex
Copy the current immutable object by setting a present value for the optionalmagicNumberHexattribute.- Parameters:
value- The value for magicNumberHex- Returns:
- A modified copy of
thisobject
-
withMagicNumberHex
Copy the current immutable object by setting an optional value for themagicNumberHexattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for magicNumberHex- Returns:
- A modified copy of
thisobject
-
withMimeType
Copy the current immutable object by setting a present value for the optionalmimeTypeattribute.- Parameters:
value- The value for mimeType- Returns:
- A modified copy of
thisobject
-
withMimeType
Copy the current immutable object by setting an optional value for themimeTypeattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for mimeType- Returns:
- A modified copy of
thisobject
-
withCreated
Copy the current immutable object by setting a present value for the optionalcreatedattribute.- Parameters:
value- The value for created- Returns:
- A modified copy of
thisobject
-
withCreated
Copy the current immutable object by setting an optional value for thecreatedattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for created- Returns:
- A modified copy of
thisobject
-
withModified
Copy the current immutable object by setting a present value for the optionalmodifiedattribute.- Parameters:
value- The value for modified- Returns:
- A modified copy of
thisobject
-
withModified
Copy the current immutable object by setting an optional value for themodifiedattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for modified- Returns:
- A modified copy of
thisobject
-
withAccessed
Copy the current immutable object by setting a present value for the optionalaccessedattribute.- Parameters:
value- The value for accessed- Returns:
- A modified copy of
thisobject
-
withAccessed
Copy the current immutable object by setting an optional value for theaccessedattribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for accessed- Returns:
- A modified copy of
thisobject
-
withParentDirectoryRef
Copy the current immutable object by setting a present value for the optionalparentDirectoryRefattribute.- Parameters:
value- The value for parentDirectoryRef- Returns:
- A modified copy of
thisobject
-
withParentDirectoryRef
Copy the current immutable object by setting an optional value for theparentDirectoryRefattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for parentDirectoryRef- Returns:
- A modified copy of
thisobject
-
withIsEncrypted
Copy the current immutable object by setting a present value for the optionalisEncryptedattribute.- Parameters:
value- The value for isEncrypted- Returns:
- A modified copy of
thisobject
-
withIsEncrypted
Copy the current immutable object by setting an optional value for theisEncryptedattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for isEncrypted- Returns:
- A modified copy of
thisobject
-
withEncryptionAlgorithm
Copy the current immutable object by setting a present value for the optionalencryptionAlgorithmattribute.- Parameters:
value- The value for encryptionAlgorithm- Returns:
- A modified copy of
thisobject
-
withEncryptionAlgorithm
Copy the current immutable object by setting an optional value for theencryptionAlgorithmattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for encryptionAlgorithm- Returns:
- A modified copy of
thisobject
-
withDecryptionKey
Copy the current immutable object by setting a present value for the optionaldecryptionKeyattribute.- Parameters:
value- The value for decryptionKey- Returns:
- A modified copy of
thisobject
-
withDecryptionKey
Copy the current immutable object by setting an optional value for thedecryptionKeyattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for decryptionKey- Returns:
- A modified copy of
thisobject
-
withContentRef
Copy the current immutable object by setting a present value for the optionalcontentRefattribute.- Parameters:
value- The value for contentRef- Returns:
- A modified copy of
thisobject
-
withContentRef
Copy the current immutable object by setting an optional value for thecontentRefattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for contentRef- Returns:
- A modified copy of
thisobject
-
withType
Copy the current immutable object by setting a value for thetypeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for type (can benull)- Returns:
- A modified copy of the
thisobject
-
withExtensions
Copy the current immutable object with elements that replace the content ofextensions.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withExtensions
Copy the current immutable object with elements that replace the content ofextensions. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of extensions elements to set- Returns:
- A modified copy of
thisobject
-
withObservableObjectKey
Copy the current immutable object by setting a value for theobservableObjectKeyattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for observableObjectKey- Returns:
- A modified copy of the
thisobject
-
withDefanged
Copy the current immutable object by setting a present value for the optionaldefangedattribute.- Parameters:
value- The value for defanged- Returns:
- A modified copy of
thisobject
-
withDefanged
Copy the current immutable object by setting an optional value for thedefangedattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for defanged- Returns:
- A modified copy of
thisobject
-
withCustomProperties
Copy the current immutable object by replacing thecustomPropertiesmap with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
entries- The entries to be added to the customProperties map- Returns:
- A modified copy of
thisobject
-
withObjectMarkingRefs
Copy the current immutable object with elements that replace the content ofobjectMarkingRefs.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withObjectMarkingRefs
Copy the current immutable object with elements that replace the content ofobjectMarkingRefs. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of objectMarkingRefs elements to set- Returns:
- A modified copy of
thisobject
-
withGranularMarkings
Copy the current immutable object with elements that replace the content ofgranularMarkings.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withGranularMarkings
Copy the current immutable object with elements that replace the content ofgranularMarkings. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of granularMarkings elements to set- Returns:
- A modified copy of
thisobject
-
withHydrated
Copy the current immutable object by setting a value for thehydratedattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for hydrated- Returns:
- A modified copy of the
thisobject
-
withToJsonString
Copy the current immutable object by setting a value for thetoJsonStringattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for toJsonString (can benull)- Returns:
- A modified copy of the
thisobject
-
equals
This instance is equal to all instances ofFilethat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:hashes,size,name,nameEnc,magicNumberHex,mimeType,created,modified,accessed,parentDirectoryRef,isEncrypted,encryptionAlgorithm,decryptionKey,contentRef,id,type,extensions,observableObjectKey,defanged,customProperties,objectMarkingRefs,granularMarkings,hydrated,toJsonString. -
toString
Prints the immutable valueFilewith attribute values. -
copyOf
Creates an immutable copy of aFileCoovalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable File instance
-
builder
Creates a builder forFile.- Returns:
- A new File builder
-