public class FirmwarePayloadBuilder extends AbstractBuilder
Constructor and Description |
---|
FirmwarePayloadBuilder() |
Modifier and Type | Method and Description |
---|---|
FirmwarePayloadBuilder |
addCondition(FirmwareRequirement<FirmwareCondition> condition)
Adds a new condition to the list of conditions.
|
FirmwarePayloadBuilder |
addDigest(DigestType type,
HashAlgorithm algorithm,
byte[] digest)
Sets the file's hash value, for the provided algorithm, to the provided value.
|
FirmwarePayloadBuilder |
addDigest(DigestType type,
HashAlgorithm algorithm,
File file)
Sets the to-be-built file's hash value, for the provided algorithm, to the provided value.
|
FirmwarePayloadBuilder |
addDigest(DigestType type,
HashAlgorithm algorithm,
InputStream is)
Sets the file's hash value, for the provided algorithm, to the provided value.
|
FirmwarePayloadBuilder |
addDigest(FirmwarePayloadDigest digest)
Adds a new digest to the list of digests.
|
FirmwarePayloadBuilder |
addDirective(FirmwareRequirement<FirmwareDirective> directive)
Adds a new directive to the list of directives.
|
FirmwarePayloadBuilder |
componentIndex(String componentIndex)
Set the component index.
|
FirmwarePayloadBuilder |
description(String description)
Set the version of the firmware payload.
|
FirmwarePayloadBuilder |
firmwarePackage(FirmwarePayloadPackage firmwarePackage)
Set the component firmwarePackage.
|
FirmwarePayloadBuilder |
formatGuidance(byte[] bytes)
Set the firmware payload's format guidance.
|
FirmwarePayloadBuilder |
formatType(int type)
Set the format type.
|
String |
getComponentIndex()
Retrieve the index value of the firmware component.
|
List<FirmwareRequirement<FirmwareCondition>> |
getConditions()
Retrieve the conditions of the firmware payload.
|
String |
getDescription()
Retrieve the description of the firmware payload.
|
List<FirmwarePayloadDigest> |
getDigests()
Retrieve the digests of the firmware payload.
|
List<FirmwareRequirement<FirmwareDirective>> |
getDirectives()
Retrieve the directives of the firmware payload.
|
FirmwarePayloadPackage |
getFirmwarePackage()
Retrieve the firmwarePackage of the firmware component.
|
byte[] |
getFormatGuidance()
Retrieve the firmware payload's format guidance.
|
int |
getFormatType()
Retrieve the format type of the firmware payload.
|
FirmwareIdentifier |
getId()
Retrieve the identifier of the firmware payload.
|
String |
getPackageIdentifier()
Retrieve the package identifier of the firmware manifest.
|
BigInteger |
getSimpleVersion()
Retrieve the simple version of the firmware payload.
|
BigInteger |
getSize()
Retrieve the size the firmware payload.
|
FirmwareIdentifier |
getStorageId()
Retrieve the storage id of the firmware component.
|
FirmwarePayloadBuilder |
id(FirmwareIdentifier id)
Set the id of the firmware payload.
|
FirmwarePayloadBuilder |
packageIdentifier(String packageIdentifier)
Set the package identifier.
|
void |
reset() |
FirmwarePayloadBuilder |
simpleVersion(BigInteger version)
Set the simple version of the payload.
|
FirmwarePayloadBuilder |
size(BigInteger size)
Set the size.
|
FirmwarePayloadBuilder |
storageId(FirmwareIdentifier id)
Set the storage id.
|
void |
validate() |
isValid, validateNonEmpty, validateNonEmpty, validateNonEmpty, validateNonEmpty, validateNonNull, validatePatternMatch
public FirmwareIdentifier getId()
public FirmwarePayloadBuilder id(FirmwareIdentifier id)
id
- the firmware's identifierpublic String getPackageIdentifier()
public FirmwarePayloadBuilder packageIdentifier(String packageIdentifier)
packageIdentifier
- a non-null
package identifierpublic String getDescription()
public FirmwarePayloadBuilder description(String description)
description
- the firmware's descriptionpublic int getFormatType()
public FirmwarePayloadBuilder formatType(int type)
type
- a format typepublic byte[] getFormatGuidance()
public FirmwarePayloadBuilder formatGuidance(byte[] bytes)
bytes
- guidance a non-null
byte stringpublic BigInteger getSize()
public FirmwarePayloadBuilder size(BigInteger size)
size
- a non-null
sizepublic BigInteger getSimpleVersion()
public FirmwarePayloadBuilder simpleVersion(BigInteger version)
version
- a non-null
versionpublic List<FirmwarePayloadDigest> getDigests()
public FirmwarePayloadBuilder addDigest(FirmwarePayloadDigest digest)
digest
- the digest to addpublic FirmwarePayloadBuilder addDigest(DigestType type, HashAlgorithm algorithm, File file) throws NoSuchAlgorithmException, IOException
InputStream
is used to retrieve the files contents to calculate the hash value. The
caller is responsible for closing the stream used by this method.type
- the type of resource this digest is foralgorithm
- the algorithm to establish a hash value forfile
- the file to hashNoSuchAlgorithmException
- if the hash algorithm is not supportedIOException
- if an error occurs while reading the streampublic FirmwarePayloadBuilder addDigest(DigestType type, HashAlgorithm algorithm, InputStream is) throws NoSuchAlgorithmException, IOException
InputStream
is used to retrieve the files contents to calculate the hash value. The
caller is responsible for closing the stream used by this method.type
- the type of resource this digest is foralgorithm
- the algorithm to establish a hash value foris
- an InputStream
that can be used to read the fileNoSuchAlgorithmException
- if the hash algorithm is not supportedIOException
- if an error occurs while reading the streampublic FirmwarePayloadBuilder addDigest(DigestType type, HashAlgorithm algorithm, byte[] digest)
type
- the type of resource this digest is foralgorithm
- the algorithm to establish a hash value fordigest
- an array of bytes representing the digest valuepublic String getComponentIndex()
public FirmwarePayloadBuilder componentIndex(String componentIndex)
componentIndex
- a non-null
component indexpublic FirmwareIdentifier getStorageId()
public FirmwarePayloadBuilder storageId(FirmwareIdentifier id)
id
- a non-null
storage idpublic List<FirmwareRequirement<FirmwareCondition>> getConditions()
public FirmwarePayloadBuilder addCondition(FirmwareRequirement<FirmwareCondition> condition)
condition
- the condition to addpublic List<FirmwareRequirement<FirmwareDirective>> getDirectives()
public FirmwarePayloadBuilder addDirective(FirmwareRequirement<FirmwareDirective> directive)
directive
- the directive to addpublic FirmwarePayloadPackage getFirmwarePackage()
public FirmwarePayloadBuilder firmwarePackage(FirmwarePayloadPackage firmwarePackage)
firmwarePackage
- a non-null
firmwarePackagepublic void validate() throws ValidationException
ValidationException
public void reset()
Copyright © 2020 National Institute of Standards and Technology. All rights reserved.