Class DownloadBinary

java.lang.Object
com.uc4.communication.requests.XMLRequest
com.uc4.communication.requests.DownloadBinary

public class DownloadBinary extends XMLRequest
Downloads a file from a STORE object.
  • Constructor Details

    • DownloadBinary

      public DownloadBinary(UC4ObjectName storeObject, String entryName, PlatformSwHwType platformSwHw)
      Creates a new request to download a file from a STORE object.
      Parameters:
      storeObject - Name of the STORE object
      entryName - Name of the entry which is used to identify the file.
      platformSwHw - Combined type of Platform, SW, HW of the entry.
    • DownloadBinary

      public DownloadBinary(UC4ObjectName storeObject, String entryName, PlatformSwHwType platformSwHw, File outputFile)
      Creates a new request to download a file from a STORE object.
      Parameters:
      storeObject - Name of the STORE object
      entryName - Name of the entry which is used to identify the file.
      platformSwHw - Combined type of Platform, SW, HW of the entry.
      outputFile - Outputfile, where the content will be automatically be stored.
    • DownloadBinary

      public DownloadBinary(UC4ObjectName storeObject, String entryName, PlatformSwHwType platformSwHw, String resname)
      Creates a new request to download a file from STORE object.
      Parameters:
      storeObject - Name of the STORE object
      entryName - Name of the entry which is used to identify the file.
      platformSwHw - Combined type of Platform, SW, HW of the entry.
      resname - resource name of the entry which is used to identify the file.
    • DownloadBinary

      public DownloadBinary(UC4ObjectName storeObject, String entryName, PlatformSwHwType platformSwHw, File outputFile, String resname)
      Creates a new request to download a file from a STORE object.
      Parameters:
      storeObject - Name of the STORE object
      entryName - Name of the entry which is used to identify the file.
      platformSwHw - Combined type of Platform, SW, HW of the entry.
      outputFile - Outputfile, where the content will be automatically be stored.
      resname - Resource name of the entry which is used to identify the file.
  • Method Details

    • getSrc

      protected String getSrc()
      Description copied from class: XMLRequest
      Returns the request source. This method is used internally.
      Specified by:
      getSrc in class XMLRequest
      Returns:
      Source
    • createRequest

      protected void createRequest(com.uc4.util.XMLDocument doc, Element request, ConnectionAttributes sessionInfo)
      Description copied from class: XMLRequest
      Creates the XML Document for the request. This method is used internally.
      Specified by:
      createRequest in class XMLRequest
      Parameters:
      doc - Document, used to create new Elements
      request - Request Element - classes append information to this request element
      sessionInfo - Information about the session
    • createNATRequest

      protected com.automic.protocol.Message createNATRequest(ConnectionAttributes sessionInfo)
      Description copied from class: XMLRequest
      Sub classes may override this method send messages in NAT protocol to the AE.
      Overrides:
      createNATRequest in class XMLRequest
      Parameters:
      sessionInfo - Session infos
      Returns:
      Message or null if not used
    • handleContent

      protected void handleContent(com.uc4.util.XMLDocument doc, ConnectionAttributes session)
      Description copied from class: XMLRequest
      Sub classes extract the values from the XML document and provide public getter methods.
      Overrides:
      handleContent in class XMLRequest
      Parameters:
      doc - XML Document
      session - Info about the user session
    • isText

      public boolean isText()
      Returns true if the resource is a text. The method getContentAsText() can be used.
      Returns:
      true if the file is a text file, false in case of binaries.
    • isBinary

      public boolean isBinary()
      Returns true if the file is a binary and not a text file.
      Returns:
      true if the file is not a text file.
    • getBinaryContent

      public ByteBuffer getBinaryContent()
      Returns the file as ByteBuffer.
      Returns:
      file content
    • getContentAsText

      public String getContentAsText()
      Returns the content of a text file. This method should only be called if isText() returns true. The default line seperator is used.
      Returns:
      String containing the file content
    • getContentAsText

      public String getContentAsText(String lineSeparator)
      Returns the content of a text file using a specified line line seperator.
      Parameters:
      lineSeparator - Characters used as line seperator.
      Returns:
      Content of the text file
    • isOutputFileOK

      public boolean isOutputFileOK()
      Returns true if the outputfile was saved successfully. If this method returns false the method getFileIOException can be used to get the exception which occured during the writing of the outputfile.
      Returns:
      True if the outputfile was saved successfully.
    • getFileIOException

      public IOException getFileIOException()
      Returns the Exception that occured during the writing of the outputfile or null if it was successful.
      Returns:
      IOException or null
    • getResourceName

      public String getResourceName()
      Returns the resource name which was set, or null if it was not set.
      Returns:
      resname or null;