本文整理汇总了Java中org.codehaus.plexus.digest.DigesterException类的典型用法代码示例。如果您正苦于以下问题:Java DigesterException类的具体用法?Java DigesterException怎么用?Java DigesterException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DigesterException类属于org.codehaus.plexus.digest包,在下文中一共展示了DigesterException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeMergedMetadataToFile
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
private File writeMergedMetadataToFile( ArchivaRepositoryMetadata mergedMetadata, String outputFilename )
throws RepositoryMetadataException, DigesterException, IOException
{
File outputFile = new File( outputFilename );
if ( outputFile.exists() )
{
FileUtils.deleteQuietly( outputFile );
}
outputFile.getParentFile().mkdirs();
RepositoryMetadataWriter.write( mergedMetadata, outputFile );
createChecksumFile( outputFilename, digestSha1 );
createChecksumFile( outputFilename, digestMd5 );
return outputFile;
}
示例2: verifyChecksum
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
private boolean verifyChecksum( File file, String fileName, Digester digester, Artifact artifact, String key )
throws IOException
{
boolean result = true;
File checksumFile = new File( file.getParentFile(), fileName );
if ( checksumFile.exists() )
{
String checksum = FileUtils.readFileToString( checksumFile, Charset.defaultCharset() );
try
{
digester.verify( file, checksum );
}
catch ( DigesterException e )
{
addWarning( artifact, Messages.getString( key ) );
result = false;
}
}
return result;
}
示例3: writeMergedMetadataToFile
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
private Path writeMergedMetadataToFile( ArchivaRepositoryMetadata mergedMetadata, String outputFilename )
throws RepositoryMetadataException, DigesterException, IOException
{
Path outputFile = Paths.get( outputFilename );
if ( Files.exists(outputFile) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( outputFile );
}
Files.createDirectories(outputFile.getParent());
RepositoryMetadataWriter.write( mergedMetadata, outputFile );
createChecksumFile( outputFilename, digestSha1 );
createChecksumFile( outputFilename, digestMd5 );
return outputFile;
}
示例4: verifyChecksum
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
private boolean verifyChecksum( Path file, String fileName, Digester digester, Artifact artifact, String key )
throws IOException
{
boolean result = true;
Path checksumFile = file.resolveSibling( fileName );
if ( Files.exists(checksumFile) )
{
String checksum = org.apache.archiva.common.utils.FileUtils.readFileToString( checksumFile, Charset.defaultCharset() );
try
{
digester.verify( file.toFile(), checksum );
}
catch ( DigesterException e )
{
addWarning( artifact, Messages.getString( key ) );
result = false;
}
}
return result;
}
示例5: createChecksumFile
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
private void createChecksumFile( String path, Digester digester )
throws DigesterException, IOException
{
File checksumFile = new File( path + digester.getFilenameExtension() );
if ( !checksumFile.exists() )
{
FileUtils.deleteQuietly( checksumFile );
checksum.createChecksum( new File( path ), digester );
}
else if ( !checksumFile.isFile() )
{
log.error( "Checksum file is not a file." );
}
}
示例6: createChecksums
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
/**
* Create checksums of file using all digesters defined at construction time.
*
* @param file
* @param force whether existing checksums should be overwritten or not
* @throws IOException
*/
protected void createChecksums( File file, boolean force )
throws IOException
{
for ( Digester digester : getDigesters() )
{
File checksumFile = new File( file.getAbsolutePath() + "." + getDigesterFileExtension( digester ) );
if ( checksumFile.exists() )
{
if ( !force )
{
continue;
}
createBackup( checksumFile );
}
else
{
createdFiles.add( checksumFile );
}
try
{
writeStringToFile( checksumFile, digester.calc( file ) );
}
catch ( DigesterException e )
{
throw (IOException) e.getCause();
}
}
}
示例7: createChecksumFile
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
private void createChecksumFile( String path, Digester digester )
throws DigesterException, IOException
{
Path checksumFile = Paths.get( path + digester.getFilenameExtension() );
if ( !Files.exists(checksumFile) )
{
org.apache.archiva.common.utils.FileUtils.deleteQuietly( checksumFile );
checksum.createChecksum( Paths.get( path ).toFile(), digester );
}
else if ( !Files.isRegularFile( checksumFile) )
{
log.error( "Checksum file is not a file." );
}
}
示例8: createChecksums
import org.codehaus.plexus.digest.DigesterException; //导入依赖的package包/类
/**
* Create checksums of file using all digesters defined at construction time.
*
* @param file
* @param force whether existing checksums should be overwritten or not
* @throws IOException
*/
protected void createChecksums( Path file, boolean force )
throws IOException
{
for ( Digester digester : getDigesters() )
{
Path checksumFile = Paths.get(file.toAbsolutePath() + "." + getDigesterFileExtension( digester ) );
if ( Files.exists(checksumFile) )
{
if ( !force )
{
continue;
}
createBackup( checksumFile );
}
else
{
createdFiles.add( checksumFile );
}
try
{
writeStringToFile( checksumFile, digester.calc( file.toFile() ) );
}
catch ( DigesterException e )
{
throw (IOException) e.getCause();
}
}
}