Interface ICCFile

All Superinterfaces:
Comparable<ICCFile>, ICCBase, ICCCoverageData, ICCCoverageDataBasic, ICCPercentItem, ICCSource, ICCStatementData, ICCStatementDataBasic, ICCTreeItem
All Known Subinterfaces:
ICCImportFile

Represents a file or listing file in the CC results.
New behavior in v9
The order that flowpoints are returned has been changed from undefined to ordered by the flowpoint's first line. This means that flowpoints will be returned in the order that they appear in the file. This also affects the ICCTreeItem.getChildren().
Since:
3.1
  • Method Details

    • getBaseName

      String getBaseName()
      Returns a "normalized" or "common" name for the file that can be used to compare. The name has information that can change during build from the name allowing for comparisons.

      NOTE: This may be the same as the base name ICCBase.getName().

      Returns:
      the common name of the file
    • getBaseFileName

      String getBaseFileName()
      Returns the file name without any path information.
      Returns:
      unqualified file name - no path information
      Since:
      4.0
    • getFile

      File getFile()
      Returns a local file if available. If null is returned use getStream() when the contents are in a zip or remote system. If @see ICCResult.setUnZipOptions(String) is set then the zipped file will automatically be unzipped and returned. Use getFile(boolean) if you need to override the automatic unzip option. Use getEncoding() to get the encoding of the file's contents.
      Specified by:
      getFile in interface ICCSource
      Returns:
      Cached File or null if not available
      Since:
      3.1
    • getFile

      File getFile(boolean unzip)
      Same as getFile() but can override the automatic unzip option. if false is specified then no unzip will be attempted. if true is specified then unzip will use the unzip dir set in ICCResult or to a temp file if. it is not set. i.e. this will force an unzip if true is specified.
      Specified by:
      getFile in interface ICCSource
      Parameters:
      unzip - if true then unzip contents to unzip directory
      Returns:
      file that was unzipped
      Since:
      5.0
    • getStream

      InputStream getStream() throws IOException
      Returns an input stream to the contents if it is available. isSourceAvailable() can be used to determine if source is available. A FileInputStream will be returned if the file is available on the file system otherwise a basic InputStream is returned. Caller must close the stream when done Use getEncoding() to determine the encoding of the contents
      Specified by:
      getStream in interface ICCSource
      Returns:
      InputStream to the file's contents or null if source is not available
      Throws:
      IOException - error getting stream
    • getStream

      InputStream getStream(boolean includeMarkers) throws IOException
      Same as getStream() but can return the input stream with code coverage indicators injected. if false is specified then no markers will be injected and the behavior will be the same as getStream(). if true is specified an input stream with code coverage markers injected will be returned
      Specified by:
      getStream in interface ICCSource
      Parameters:
      includeMarkers - include code coverage markers
      Returns:
      input stream with markers
      Throws:
      IOException - exception getting stream
      Since:
      10.0
    • getEncoding

      String getEncoding()
      Return the encoding of the stream or file returned by the implementer of this interface See Charset for a suggested list of possible encodings
      Specified by:
      getEncoding in interface ICCSource
      Returns:
      the encoding of the stream or file returned by this artifact, JVM's default charset if it is not known
      Since:
      7.0
    • getSignature

      byte[] getSignature()
      Returns an array of bytes that represent a unique signature for this file's contents The implementation guarantees that the signature from files that have the exact same content will match This can be used to compare with another file to make sure it is the same. This may be generated on the fly or cached for faster lookup
      Returns:
      an array of bytes that represents a unique signature based on the file contents or null if there is no file content
      Since:
      4.0
    • getLanguage

      int getLanguage()
      Return an int that represents the compiled language of the file Refer to ICCConstants for possible values
      Specified by:
      getLanguage in interface ICCSource
      Returns:
      one of languages in ICCConstants
    • getFlowPoints

      ICCFlowPoint[] getFlowPoints()
      Returns a flat list of flowpoints. To obtain the structure of the flowpoints use getRootFlowPoints() to obtain 1 or more root flowpoints and then navigate the hierarchy. The list is obtained during collection and may not represent a complete list as it appears in the source. Debug technology and compiler optimization may not expose all the functions for some languages. In v9 the returned list is sorted by the flowpoint's first line number. This will reflect the order that they appear in file. While this is a flattened list each flowpoint may have a parent and/or children

      NOTE: the implementation of this call may be cached to improve performance. Importers (classes that populate flowpoints) should use getChildren() calls to work with lists of flowpoints to avoid locking in this cached value unless the caller knows the population of flowpoints has been completed.

      Returns:
      array of ICCFlowPoint functions/entry points
    • getFlowPoint

      ICCFlowPoint getFlowPoint(String name)
      Returns the first flow point with the given name When there is a flowpoint hierarchy, this will only return the first entry in the hierarchy that is found to match the name. If the passed name is qualified then the flowpoint hierarchy will be traversed looking for the matching flowpoint For most languages this may be correct as there is only one entry that matches the name. For languages that can have the same flowpoint in different scopes use getFlowPoints(String) to get all matches.

      NOTE: the implementation of this call may be cached to improve performance. Importers (classes that populate flowpoints) should use getChildren() calls to work with lists of flowpoints to avoid locking in this cached value unless the caller knows the population of flowpoints has been completed.

      Parameters:
      name - flowpoint name
      Returns:
      null or flowpoint that matches the name
    • getFlowPointByQualifiedName

      ICCFlowPoint getFlowPointByQualifiedName(String qualifiedName)
      Returns the first flow point with the given qualified name, using / as a separator

      NOTE: the implementation of this call may be cached to improve performance. Importers (classes that populate flowpoints) should use getChildren() calls to work with lists of flowpoints to avoid locking in this cached value unless the caller knows the population of flowpoints has been completed.

      Parameters:
      qualifiedName - flowpoint qualified name
      Returns:
      null or flowpoint that matches the qualified name
      Since:
      10.0
    • getFlowPoints

      ICCFlowPoint[] getFlowPoints(String name)
      Return zero of more flowpoints that match the name. Unlike getFlowPoint(String) it will return all flowpoints that match This will scan the whole hierarchy looking for a match. The order of the returned list is undefined

      NOTE: the implementation of this call may be cached to improve performance. Importers (classes that populate flowpoints) should use getChildren() calls to work with lists of flowpoints to avoid locking in this cached value unless the caller knows the population of flowpoints has been completed.

      Parameters:
      name - flowpoint name
      Returns:
      zero or more matches
      Since:
      8.0
    • getFlowPoint

      ICCFlowPoint getFlowPoint(int id)
      Returns the ICCFlowPoint with the matching ID or null

      NOTE: the implementation of this call may be cached to improve performance. Importers (classes that populate flowpoints) should use getChildren() calls to work with lists of flowpoints to avoid locking in this cached value unless the caller knows the population of flowpoints has been completed.

      Parameters:
      id - flowpoint id
      Returns:
      ICCFlowPoint or null
      Since:
      9.0
    • isNameMatch

      boolean isNameMatch(String fileName)
      Indicates whether or not the specified file name matches the name for this file.
      Parameters:
      fileName - the file name to check, may or may not include file extension or be a base name
      Returns:
      true if the base name matches, false otherwise
      Since:
      3.1
    • getRootFlowPoints

      ICCFlowPoint[] getRootFlowPoints()
      The list of root (ie have no parents) flowpoints.
      Flowpoints are obtained during collection and may not represent a complete list as it appears in the source Debug technology and compiler optimization may not expose all the functions for some languages In v9 this list will be sorted by the flowpoint's first line number
      Returns:
      array of ICCFlowPoint root functions/entry points
      Since:
      4.0
    • isSourceAvailable

      boolean isSourceAvailable()
      Returns true if the contents of this file are available getFile() can be used to get at the contents from the file system getStream() can be used to get the contents from both the file system or from a zip
      Specified by:
      isSourceAvailable in interface ICCSource
      Returns:
      true if source is available
      Since:
      4.0
    • getSourceZipPath

      String getSourceZipPath()
      Returns a path to the zip that contains the source This can be used when the caller wants to extract and manage the contents
      Returns:
      source zip path
      Since:
      4.0
    • getSourceDirectory

      String getSourceDirectory()
      Returns the source directory. In the case of a zip this is the directory inside the zip and is relative to the root of the zip file
      Returns:
      source directory
      Since:
      4.0
    • getParts

      ICCPart[] getParts()
      Returns 0 or more artifacts that were created as a result of processing this file e.g. a compile unit or object that was created when this file was compiled
      Returns:
      array of zero or more parts
      Since:
      6.0