Package freenet.crypt

Examples of freenet.crypt.MultiHashOutputStream


      if(logMINOR) Logger.minor(this, "Not compressing "+origData+" size = "+origSize+" block size = "+blockSize);
      HashResult[] hashes = null;
      if(wantHashes != 0) {
        // Need to get the hashes anyway
        NullOutputStream nos = new NullOutputStream();
        MultiHashOutputStream hasher = new MultiHashOutputStream(nos, wantHashes);
        try {
          BucketTools.copyTo(data, hasher, data.size());
        } catch (IOException e) {
          throw new InsertException(InsertExceptionMode.BUCKET_ERROR, "I/O error generating hashes", e, null);
        }
        hashes = hasher.getResults();
      }
      final CompressionOutput output = new CompressionOutput(data, null, hashes);
      context.getJobRunner(persistent).queueNormalOrDrop(new PersistentJob() {

                @Override
View Full Code Here


            OutputStream os = metadataTemp.getOutputStream();
            OutputStream cos = checksumOutputStream(os);
            BufferedOutputStream bos = new BufferedOutputStream(cos);
            try {
                // Need something bigger than a CRC for this...
                MultiHashOutputStream mos = new MultiHashOutputStream(bos, HashType.SHA256.bitmask);
                metadata.writeTo(new DataOutputStream(mos));
                mos.getResults()[0].writeTo(bos);
            } catch (MetadataUnresolvedException e) {
                throw new FetchException(FetchExceptionMode.INTERNAL_ERROR, "Metadata not resolved starting splitfile fetch?!: "+e, e);
            }
            bos.close();
            long metadataLength = metadataTemp.size();
View Full Code Here

TOP

Related Classes of freenet.crypt.MultiHashOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.