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:
  • Method Details

    • getHashes

      @JsonPropertyDescription("Specifies a dictionary of hashes for the contents of the file.") public com.google.common.collect.ImmutableMap<String,String> getHashes()
      Specified by:
      getHashes in interface FileCoo
      Returns:
      The value of the hashes attribute
    • getSize

      @JsonPropertyDescription("Specifies the size of the file, in bytes, as a non-negative integer.") public Optional<Long> getSize()
      Specified by:
      getSize in interface FileCoo
      Returns:
      The value of the size attribute
    • getName

      @JsonPropertyDescription("Specifies the name of the file.") public Optional<String> getName()
      Specified by:
      getName in interface FileCoo
      Returns:
      The value of the name attribute
    • getNameEnc

      @JsonPropertyDescription("Specifies the observed encoding for the name of the file.") public Optional<String> getNameEnc()
      Specified by:
      getNameEnc in interface FileCoo
      Returns:
      The value of the nameEnc attribute
    • 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:
      getMagicNumberHex in interface FileCoo
      Returns:
      The value of the magicNumberHex attribute
    • getMimeType

      @JsonPropertyDescription("Specifies the MIME type name specified for the file, e.g., \'application/msword\'.") public Optional<String> getMimeType()
      Specified by:
      getMimeType in interface FileCoo
      Returns:
      The value of the mimeType attribute
    • getCreated

      @JsonPropertyDescription("Specifies the date/time the file was created.") public Optional<StixInstant> getCreated()
      Specified by:
      getCreated in interface FileCoo
      Returns:
      The value of the created attribute
    • getModified

      @JsonPropertyDescription("Specifies the date/time the file was last written to/modified.") public Optional<StixInstant> getModified()
      Specified by:
      getModified in interface FileCoo
      Returns:
      The value of the modified attribute
    • getAccessed

      @JsonPropertyDescription("Specifies the date/time the file was last accessed.") public Optional<StixInstant> getAccessed()
      Specified by:
      getAccessed in interface FileCoo
      Returns:
      The value of the accessed attribute
    • getParentDirectoryRef

      @JsonPropertyDescription("Specifies the parent directory of the file, as a reference to a Directory Object.") public Optional<String> getParentDirectoryRef()
      Specified by:
      getParentDirectoryRef in interface FileCoo
      Returns:
      The value of the parentDirectoryRef attribute
    • isEncrypted

      @JsonPropertyDescription("Specifies whether the file is encrypted.") public Optional<Boolean> isEncrypted()
      Specified by:
      isEncrypted in interface FileCoo
      Returns:
      The value of the isEncrypted attribute
    • 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:
      getEncryptionAlgorithm in interface FileCoo
      Returns:
      The value of the encryptionAlgorithm attribute
    • getDecryptionKey

      @JsonPropertyDescription("Specifies the decryption key used to decrypt the archive file.") public Optional<String> getDecryptionKey()
      Specified by:
      getDecryptionKey in interface FileCoo
      Returns:
      The value of the decryptionKey attribute
    • getContentRef

      @JsonPropertyDescription("Specifies the content of the file, represented as an Artifact Object.") public Optional<String> getContentRef()
      Specified by:
      getContentRef in interface FileCoo
      Returns:
      The value of the contentRef attribute
    • getId

      public String 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:
      getId in interface BundleableObject
      Specified by:
      getId in interface CyberObservableObjectCommonProperties
      Specified by:
      getId in interface FileCoo
    • getType

      public String getType()
      Specified by:
      getType in interface BundleableObject
      Specified by:
      getType in interface CyberObservableObjectCommonProperties
      Returns:
      The value of the type attribute
    • 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:
      getExtensions in interface CyberObservableObjectCommonProperties
    • getObservableObjectKey

      public String getObservableObjectKey()
      Used for generation of Map Keys by
      invalid reference
      ObservedDataSdo#getObjects()
      Manually set this value if you want to control key names. Otherwise UUIDs will be used.
      Specified by:
      getObservableObjectKey in interface CyberObservableObjectCommonProperties
    • 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:
      getDefanged in interface CyberObservableObjectCommonProperties
    • getCustomProperties

      public com.google.common.collect.ImmutableMap<String,Object> 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:
      getCustomProperties in interface StixCustomProperties
      Returns:
      Map of custom properties Map<String, Object>
    • getObjectMarkingRefs

      public com.google.common.collect.ImmutableSet<MarkingDefinitionDm> getObjectMarkingRefs()
      Specified by:
      getObjectMarkingRefs in interface BundleableObject
      Returns:
      The value of the objectMarkingRefs attribute
    • getGranularMarkings

      public com.google.common.collect.ImmutableSet<GranularMarkingDm> getGranularMarkings()
      Specified by:
      getGranularMarkings in interface BundleableObject
      Returns:
      The value of the granularMarkings attribute
    • getHydrated

      public boolean getHydrated()
      Specified by:
      getHydrated in interface BundleableObject
      Returns:
      The value of the hydrated attribute
    • toJsonString

      public String toJsonString()
      Specified by:
      toJsonString in interface BundleableObject
      Returns:
      The value of the toJsonString attribute
    • withHashes

      public final File withHashes(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the hashes map 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 returning this.
      Parameters:
      entries - The entries to be added to the hashes map
      Returns:
      A modified copy of this object
    • withSize

      public final File withSize(long value)
      Copy the current immutable object by setting a present value for the optional size attribute.
      Parameters:
      value - The value for size
      Returns:
      A modified copy of this object
    • withSize

      public final File withSize(Optional<Long> optional)
      Copy the current immutable object by setting an optional value for the size attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for size
      Returns:
      A modified copy of this object
    • withName

      public final File withName(String value)
      Copy the current immutable object by setting a present value for the optional name attribute.
      Parameters:
      value - The value for name
      Returns:
      A modified copy of this object
    • withName

      public final File withName(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the name attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for name
      Returns:
      A modified copy of this object
    • withNameEnc

      public final File withNameEnc(String value)
      Copy the current immutable object by setting a present value for the optional nameEnc attribute.
      Parameters:
      value - The value for nameEnc
      Returns:
      A modified copy of this object
    • withNameEnc

      public final File withNameEnc(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the nameEnc attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for nameEnc
      Returns:
      A modified copy of this object
    • withMagicNumberHex

      public final File withMagicNumberHex(String value)
      Copy the current immutable object by setting a present value for the optional magicNumberHex attribute.
      Parameters:
      value - The value for magicNumberHex
      Returns:
      A modified copy of this object
    • withMagicNumberHex

      public final File withMagicNumberHex(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the magicNumberHex attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for magicNumberHex
      Returns:
      A modified copy of this object
    • withMimeType

      public final File withMimeType(String value)
      Copy the current immutable object by setting a present value for the optional mimeType attribute.
      Parameters:
      value - The value for mimeType
      Returns:
      A modified copy of this object
    • withMimeType

      public final File withMimeType(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the mimeType attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for mimeType
      Returns:
      A modified copy of this object
    • withCreated

      public final File withCreated(StixInstant value)
      Copy the current immutable object by setting a present value for the optional created attribute.
      Parameters:
      value - The value for created
      Returns:
      A modified copy of this object
    • withCreated

      public final File withCreated(Optional<? extends StixInstant> optional)
      Copy the current immutable object by setting an optional value for the created attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for created
      Returns:
      A modified copy of this object
    • withModified

      public final File withModified(StixInstant value)
      Copy the current immutable object by setting a present value for the optional modified attribute.
      Parameters:
      value - The value for modified
      Returns:
      A modified copy of this object
    • withModified

      public final File withModified(Optional<? extends StixInstant> optional)
      Copy the current immutable object by setting an optional value for the modified attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for modified
      Returns:
      A modified copy of this object
    • withAccessed

      public final File withAccessed(StixInstant value)
      Copy the current immutable object by setting a present value for the optional accessed attribute.
      Parameters:
      value - The value for accessed
      Returns:
      A modified copy of this object
    • withAccessed

      public final File withAccessed(Optional<? extends StixInstant> optional)
      Copy the current immutable object by setting an optional value for the accessed attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for accessed
      Returns:
      A modified copy of this object
    • withParentDirectoryRef

      public final File withParentDirectoryRef(String value)
      Copy the current immutable object by setting a present value for the optional parentDirectoryRef attribute.
      Parameters:
      value - The value for parentDirectoryRef
      Returns:
      A modified copy of this object
    • withParentDirectoryRef

      public final File withParentDirectoryRef(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the parentDirectoryRef attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for parentDirectoryRef
      Returns:
      A modified copy of this object
    • withIsEncrypted

      public final File withIsEncrypted(boolean value)
      Copy the current immutable object by setting a present value for the optional isEncrypted attribute.
      Parameters:
      value - The value for isEncrypted
      Returns:
      A modified copy of this object
    • withIsEncrypted

      public final File withIsEncrypted(Optional<Boolean> optional)
      Copy the current immutable object by setting an optional value for the isEncrypted attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for isEncrypted
      Returns:
      A modified copy of this object
    • withEncryptionAlgorithm

      public final File withEncryptionAlgorithm(String value)
      Copy the current immutable object by setting a present value for the optional encryptionAlgorithm attribute.
      Parameters:
      value - The value for encryptionAlgorithm
      Returns:
      A modified copy of this object
    • withEncryptionAlgorithm

      public final File withEncryptionAlgorithm(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the encryptionAlgorithm attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for encryptionAlgorithm
      Returns:
      A modified copy of this object
    • withDecryptionKey

      public final File withDecryptionKey(String value)
      Copy the current immutable object by setting a present value for the optional decryptionKey attribute.
      Parameters:
      value - The value for decryptionKey
      Returns:
      A modified copy of this object
    • withDecryptionKey

      public final File withDecryptionKey(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the decryptionKey attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for decryptionKey
      Returns:
      A modified copy of this object
    • withContentRef

      public final File withContentRef(String value)
      Copy the current immutable object by setting a present value for the optional contentRef attribute.
      Parameters:
      value - The value for contentRef
      Returns:
      A modified copy of this object
    • withContentRef

      public final File withContentRef(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the contentRef attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for contentRef
      Returns:
      A modified copy of this object
    • withType

      public final File withType(String value)
      Copy the current immutable object by setting a value for the type attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type (can be null)
      Returns:
      A modified copy of the this object
    • withExtensions

      public final File withExtensions(CyberObservableExtension... elements)
      Copy the current immutable object with elements that replace the content of extensions.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withExtensions

      public final File withExtensions(Iterable<? extends CyberObservableExtension> elements)
      Copy the current immutable object with elements that replace the content of extensions. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of extensions elements to set
      Returns:
      A modified copy of this object
    • withObservableObjectKey

      public final File withObservableObjectKey(String value)
      Copy the current immutable object by setting a value for the observableObjectKey attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for observableObjectKey
      Returns:
      A modified copy of the this object
    • withDefanged

      public final File withDefanged(boolean value)
      Copy the current immutable object by setting a present value for the optional defanged attribute.
      Parameters:
      value - The value for defanged
      Returns:
      A modified copy of this object
    • withDefanged

      public final File withDefanged(Optional<Boolean> optional)
      Copy the current immutable object by setting an optional value for the defanged attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for defanged
      Returns:
      A modified copy of this object
    • withCustomProperties

      public final File withCustomProperties(Map<String,? extends Object> entries)
      Copy the current immutable object by replacing the customProperties map 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 returning this.
      Parameters:
      entries - The entries to be added to the customProperties map
      Returns:
      A modified copy of this object
    • withObjectMarkingRefs

      public final File withObjectMarkingRefs(MarkingDefinitionDm... elements)
      Copy the current immutable object with elements that replace the content of objectMarkingRefs.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withObjectMarkingRefs

      public final File withObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements)
      Copy the current immutable object with elements that replace the content of objectMarkingRefs. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of objectMarkingRefs elements to set
      Returns:
      A modified copy of this object
    • withGranularMarkings

      public final File withGranularMarkings(GranularMarkingDm... elements)
      Copy the current immutable object with elements that replace the content of granularMarkings.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withGranularMarkings

      public final File withGranularMarkings(Iterable<? extends GranularMarkingDm> elements)
      Copy the current immutable object with elements that replace the content of granularMarkings. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of granularMarkings elements to set
      Returns:
      A modified copy of this object
    • withHydrated

      public final File withHydrated(boolean value)
      Copy the current immutable object by setting a value for the hydrated attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for hydrated
      Returns:
      A modified copy of the this object
    • withToJsonString

      public final File withToJsonString(String value)
      Copy the current immutable object by setting a value for the toJsonString attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for toJsonString (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of File that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • 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.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value File with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static File copyOf(FileCoo instance)
      Creates an immutable copy of a FileCoo value. 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

      public static File.Builder builder()
      Creates a builder for File.
      Returns:
      A new File builder