public class ShasumSummaryFileTarget extends Object implements ExecutionTarget
ExecutionTarget that writes digests to a shasum file
compatible with "shasum -b -a <algo> <files> > sha.sum". For
compatibility with shasum only SHA-1, SHA-224, SHA-256, SHA-384,
SHA-512, SHA-512224 and SHA-512256 are supported. Only one algorithm may be
used at a time.| Modifier and Type | Field and Description |
|---|---|
protected SortedSet<String> |
algorithms
The set of algorithms encountered.
|
protected Iterable<? extends ArtifactListener> |
artifactListeners
List of listeners which are notified every time a sum file is created.
|
protected Map<ChecksumFile,Map<String,String>> |
filesHashcodes
The association file => (algorithm,hashcode).
|
static String |
LINE_SEPARATOR
The line separator character.
|
static String |
SHASUM_BINARY_FILE
The shasum binary character.
|
static String |
SHASUM_FIELD_SEPARATOR
The shasum field separator (and file type binary identifier)
|
protected File |
summaryFile
The target file where the summary is written.
|
| Constructor and Description |
|---|
ShasumSummaryFileTarget(File summaryFile,
Iterable<? extends ArtifactListener> artifactListeners)
Build a new instance of
ShasumSummaryFileTarget. |
| Modifier and Type | Method and Description |
|---|---|
void |
close(String subPath)
Close the target.
|
void |
init()
Initialize the target.
|
void |
write(String digest,
ChecksumFile file,
String algorithm)
Write the hashcode calculated for the given file and algorithm to the target.
|
public static final String LINE_SEPARATOR
public static final String SHASUM_FIELD_SEPARATOR
public static final String SHASUM_BINARY_FILE
protected Map<ChecksumFile,Map<String,String>> filesHashcodes
protected File summaryFile
protected final Iterable<? extends ArtifactListener> artifactListeners
public ShasumSummaryFileTarget(File summaryFile, Iterable<? extends ArtifactListener> artifactListeners)
ShasumSummaryFileTarget.summaryFile - the file to which the summary should be written.artifactListeners - listeners which are notified every time a CSV file is createdpublic void init()
Should be called before first call to ExecutionTarget.write(String, ChecksumFile, String).
init in interface ExecutionTargetpublic void write(String digest, ChecksumFile file, String algorithm)
write in interface ExecutionTargetdigest - the digest to write.file - the file for which the digest was calculated.algorithm - the algorithm used to calculate the digest.public void close(String subPath) throws ExecutionTargetCloseException
Should be called after last call to ExecutionTarget.write(String, ChecksumFile, String).
close in interface ExecutionTargetsubPath - part of relative path to exclude from file pathExecutionTargetCloseException - if an error occured while closing the target.Copyright © 2010–2018. All rights reserved.