Class SourceFile
java.lang.Object
ghidra.program.database.sourcemap.SourceFile
- All Implemented Interfaces:
- Comparable<SourceFile>
A SourceFile is an immutable object representing a source file.  It contains an
 absolute path along with an optional 
SourceFileIdType and identifier. 
 For example, if the id type is SourceFileIdType.MD5, the identifier would
 be the md5 sum of the source file (stored as a byte array).
 
 Note: path parameters are assumed to be absolute file paths with forward slashes as the
 separator.  For other cases, e.g. windows paths, consider the static convenience methods in
 the SourceFileUtils class.
 
 Note: you can use SourceFileUtils.hexStringToByteArray to convert hex Strings to byte 
 arrays. You can use SourceFileUtils.longToByteArray to convert long values to the
 appropriate byte arrays.
- 
Constructor SummaryConstructorsConstructorDescriptionSourceFile(String path) Constructor requiring only a path.SourceFile(String path, SourceFileIdType type, byte[] identifier) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionintcompareTo(SourceFile sourceFile) booleanReturns the filenameReturns a String representation of the identifierbyte[]Returns (a copy of) the identifierReturns the source file identifier typegetPath()Returns the pathgetUri()Returns a file URI for this SourceFile.inthashCode()toString()
- 
Constructor Details- 
SourceFileConstructor requiring only a path. The path will be normalized (seeURI.normalize()) The id type will be set toSourceFileIdType.NONEand the identifier will be set to an array of length 0.- Parameters:
- path- path
 
- 
SourceFileConstructor. The path will be normalized (seeURI.normalize()).Note: if typeisSourceFileIdType.NONE, theidentifierparameter is ignored.Note: use SourceFileUtils.longToByteArrayto convert alongvalue to the appropriatebytearray.- Parameters:
- path- path
- type- id type
- identifier- id
 
 
- 
- 
Method Details- 
getUriReturns a file URI for this SourceFile.- Returns:
- uri
 
- 
getPathReturns the path- Returns:
- path
 
- 
getFilenameReturns the filename- Returns:
- filename
 
- 
getIdTypeReturns the source file identifier type- Returns:
- id type
 
- 
getIdentifierpublic byte[] getIdentifier()Returns (a copy of) the identifier- Returns:
- identifier
 
- 
hashCodepublic int hashCode()
- 
equals
- 
toString
- 
compareTo- Specified by:
- compareToin interface- Comparable<SourceFile>
 
- 
getIdAsStringReturns a String representation of the identifier- Returns:
- id display string
 
 
-