Package org.apache.maven.internal.impl
Class DefaultChecksumAlgorithmService
java.lang.Object
org.apache.maven.internal.impl.DefaultChecksumAlgorithmService
- All Implemented Interfaces:
Service
,ChecksumAlgorithmService
@Named
@Singleton
public class DefaultChecksumAlgorithmService
extends Object
implements ChecksumAlgorithmService
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.maven.api.services.ChecksumAlgorithmService
ChecksumAlgorithmService.ChecksumAlgorithm, ChecksumAlgorithmService.ChecksumCalculator
-
Constructor Summary
ConstructorDescriptionDefaultChecksumAlgorithmService
(org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector) -
Method Summary
Modifier and TypeMethodDescriptioncalculate
(byte[] data, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) Calculates checksums for specified data.calculate
(InputStream stream, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) Calculates checksums for specified stream.calculate
(ByteBuffer data, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) Calculates checksums for specified data.calculate
(Path file, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) Calculates checksums for specified file.Returns immutable collection of all supported algorithm names.ReturnsChecksumAlgorithmService.ChecksumAlgorithm
for given algorithm name, or throws if algorithm not supported.select
(Collection<String> algorithmNames) Returns a collection ofChecksumAlgorithmService.ChecksumAlgorithm
in same order as algorithm names are ordered, or throws if any of the algorithm name is not supported.
-
Constructor Details
-
DefaultChecksumAlgorithmService
@Inject public DefaultChecksumAlgorithmService(org.eclipse.aether.spi.connector.checksum.ChecksumAlgorithmFactorySelector checksumAlgorithmFactorySelector)
-
-
Method Details
-
getChecksumAlgorithmNames
Description copied from interface:ChecksumAlgorithmService
Returns immutable collection of all supported algorithm names.- Specified by:
getChecksumAlgorithmNames
in interfaceChecksumAlgorithmService
-
select
Description copied from interface:ChecksumAlgorithmService
ReturnsChecksumAlgorithmService.ChecksumAlgorithm
for given algorithm name, or throws if algorithm not supported.- Specified by:
select
in interfaceChecksumAlgorithmService
-
select
public Collection<ChecksumAlgorithmService.ChecksumAlgorithm> select(Collection<String> algorithmNames) Description copied from interface:ChecksumAlgorithmService
Returns a collection ofChecksumAlgorithmService.ChecksumAlgorithm
in same order as algorithm names are ordered, or throws if any of the algorithm name is not supported. The returned collection has equal count of elements as passed in collection of names, and if names contains duplicated elements, the returned list of algorithms will have duplicates as well.- Specified by:
select
in interfaceChecksumAlgorithmService
-
calculate
public Map<ChecksumAlgorithmService.ChecksumAlgorithm,String> calculate(byte[] data, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) Description copied from interface:ChecksumAlgorithmService
Calculates checksums for specified data.- Specified by:
calculate
in interfaceChecksumAlgorithmService
- Parameters:
data
- The content for which to calculate checksums, must not benull
.algorithms
- The checksum algorithms to use, must not benull
.- Returns:
- The calculated checksums, indexed by algorithms, never
null
.
-
calculate
public Map<ChecksumAlgorithmService.ChecksumAlgorithm,String> calculate(ByteBuffer data, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) Description copied from interface:ChecksumAlgorithmService
Calculates checksums for specified data.- Specified by:
calculate
in interfaceChecksumAlgorithmService
- Parameters:
data
- The content for which to calculate checksums, must not benull
.algorithms
- The checksum algorithms to use, must not benull
.- Returns:
- The calculated checksums, indexed by algorithms, never
null
.
-
calculate
public Map<ChecksumAlgorithmService.ChecksumAlgorithm,String> calculate(Path file, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) throws IOException Description copied from interface:ChecksumAlgorithmService
Calculates checksums for specified file.- Specified by:
calculate
in interfaceChecksumAlgorithmService
- Parameters:
file
- The file for which to calculate checksums, must not benull
.algorithms
- The checksum algorithms to use, must not benull
.- Returns:
- The calculated checksums, indexed by algorithms, never
null
. - Throws:
IOException
- In case of any IO problem.
-
calculate
public Map<ChecksumAlgorithmService.ChecksumAlgorithm,String> calculate(InputStream stream, Collection<ChecksumAlgorithmService.ChecksumAlgorithm> algorithms) throws IOException Description copied from interface:ChecksumAlgorithmService
Calculates checksums for specified stream. Upon this method returns, the stream will be depleted (fully read) but not closed.- Specified by:
calculate
in interfaceChecksumAlgorithmService
- Parameters:
stream
- The stream for which to calculate checksums, must not benull
.algorithms
- The checksum algorithms to use, must not benull
.- Returns:
- The calculated checksums, indexed by algorithms, never
null
. - Throws:
IOException
- In case of any IO problem.
-