*
* @return a digest stream if a digest is needed, null otherwise.
*/
protected DigestOutputStream getDigestOutputStream(ISWCLibrary library, OutputStream outputStream)
{
DigestOutputStream digestStream = null;
MessageDigest messageDigest = null;
if (!hasUnsignedDigest(library))
{
try
{
messageDigest = MessageDigest.getInstance(SWCDigest.SHA_256);
digestStream = new DigestOutputStream(outputStream, messageDigest);
}
catch (NoSuchAlgorithmException e)
{
// Eat the exception, this should never happen in a
// production environment.