Class BinaryDataFile

java.lang.Object
com.tridion.data.BinaryDataFile
All Implemented Interfaces:
BinaryData

public class BinaryDataFile extends Object implements BinaryData
Binary data object that is stored in a File.
  • Constructor Details

    • BinaryDataFile

      public BinaryDataFile(int namespaceId, int publicationId, int binaryId, File binaryFile)
      Creates a new instance of this object.
      Parameters:
      namespaceId - The namespace id.
      publicationId - The publication id.
      binaryId - The binary id.
      binaryFile - The File containing the binary data.
    • BinaryDataFile

      public BinaryDataFile(int namespaceId, int publicationId, int binaryId, File binaryFile, String variantId)
  • Method Details

    • getId

      public int getId()
      Gets the id of this binary data.
      Specified by:
      getId in interface BinaryData
      Returns:
      The binary data id.
    • getNamespaceId

      public int getNamespaceId()
      Description copied from interface: BinaryData
      Gets the namespace id.
      Specified by:
      getNamespaceId in interface BinaryData
      Returns:
      namespace id
    • getPublicationId

      public int getPublicationId()
      Gets the publication id of this binary data.
      Specified by:
      getPublicationId in interface BinaryData
      Returns:
      The publication id.
    • getVariantId

      public String getVariantId()
      Returns the id of the variant for this binary data.
      Specified by:
      getVariantId in interface BinaryData
    • getInputStream

      public InputStream getInputStream() throws IOException
      Gets an InputStream representing the binary data.
      Specified by:
      getInputStream in interface BinaryData
      Returns:
      The binary data as an InputStream.
      Throws:
      IOException - If an error occurs accessing the binary data.
    • getBytes

      public byte[] getBytes() throws IOException
      Gets the binary data as an array of bytes.
      Specified by:
      getBytes in interface BinaryData
      Returns:
      byte[] representation of the binary data.
      Throws:
      IOException - If an error occurs accessing the binary data.
    • toString

      public String toString()
      Returns a string representation of this binary data file. The absolute file path representing the binary data is displayed instead of the binary data itself.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this object.
    • getDataSize

      public long getDataSize()
      Gets the size of underlying binary data.
      Specified by:
      getDataSize in interface BinaryData
      Returns:
      The binary data size.