Class ThreatTextWriter
java.lang.Object
java.io.Writer
be.kuleuven.cs.distrinet.sparta.io.ThreatWriter
be.kuleuven.cs.distrinet.sparta.io.ThreatTextWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Simple textwriter for outputing threats to a set of text files. Users of this
class should rely a specific text format for automated processing. Other
output formats are more suitable for post-processing.
-
Field Summary
Fields inherited from class be.kuleuven.cs.distrinet.sparta.io.ThreatWriter
writer -
Constructor Summary
ConstructorsConstructorDescriptionThreatTextWriter(Writer writer) Create a newThreatTextWriterto provided support for writing out a default set of threat properties to text files.Create a newThreatTextWriterto provided support for writing out a default set of threat properties to text files. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringfileNameSuggestion(Threat threat) Provide a suggested filename for writing out the threat.voidWrite-out a threatMethods inherited from class be.kuleuven.cs.distrinet.sparta.io.ThreatWriter
close, flush, getProperties, newLine, write, write
-
Constructor Details
-
ThreatTextWriter
Create a newThreatTextWriterto provided support for writing out a default set of threat properties to text files.- Parameters:
writer- a writer
-
ThreatTextWriter
Create a newThreatTextWriterto provided support for writing out a default set of threat properties to text files. If any of the provided functions return aModelElement, theThreatWriterwill attempt to retrieve the name of the element when writing it to the output writer.- Parameters:
writer- a writerproperties- a set of functions, which applied to a threat provide the property to write out
-
-
Method Details
-
write
Write-out a threat- Specified by:
writein classThreatWriter- Parameters:
threat- theThreatto write out- Throws:
IOException- If an I/O error occurs.
-
fileNameSuggestion
Provide a suggested filename for writing out the threat. This suggestion concatenates a number of theThreat's properties to attempt to obtain unique filenames for everyThreat.- Parameters:
threat- The threat for which to generate a suggested filename.- Returns:
- The suggested filename.
-