Examples of NullOutputStream


Examples of freenet.support.io.NullOutputStream

        f.inc(2, 2);
        assertEquals(fixedLength, getStoredLength(f));
    }

    private int getStoredLength(FailureCodeTracker f) throws IOException {
        CountedOutputStream os = new CountedOutputStream(new NullOutputStream());
        DataOutputStream dos = new DataOutputStream(os);
        f.writeFixedLengthTo(dos);
        dos.close();
        return (int) os.written();
    }
View Full Code Here

Examples of freenet.support.io.NullOutputStream

    } else {
      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);
View Full Code Here

Examples of freenet.support.io.NullOutputStream

    }
    return baos.toByteArray();
  }
 
    public long writtenLength() throws MetadataUnresolvedException {
        CountedOutputStream cos = new CountedOutputStream(new NullOutputStream());
        try {
            writeTo(new DataOutputStream(cos));
        } catch (IOException e) {
            throw new Error("Could not write to CountedOutputStream: "+e, e);
        }
View Full Code Here

Examples of freenet.support.io.NullOutputStream

        this.splitfileCryptoKey = splitfileCryptoKey;
        crossDataBlocksAllocated = new boolean[dataBlocks + crossCheckBlocks];
        blockChooser = new SplitFileInserterSegmentBlockChooser(this, totalBlockCount, random,
                maxRetries, keysFetching, consecutiveRNFsCountAsSuccess);
        try {
            CountedOutputStream cos = new CountedOutputStream(new NullOutputStream());
            DataOutputStream dos = new DataOutputStream(cos);
            innerStoreStatus(dos);
            dos.close();
            statusLength = (int) cos.written() + parent.checker.checksumLength();
        } catch (IOException e) {
View Full Code Here

Examples of freenet.support.io.NullOutputStream

        this.splitfileCryptoKey = splitfileCryptoKey;
        crossDataBlocksAllocated = new boolean[dataBlockCount + crossCheckBlockCount];
        blockChooser = new SplitFileInserterSegmentBlockChooser(this, totalBlockCount, random,
                maxRetries, keysFetching, consecutiveRNFsCountAsSuccess);
        try {
            CountedOutputStream cos = new CountedOutputStream(new NullOutputStream());
            DataOutputStream dos = new DataOutputStream(cos);
            innerStoreStatus(dos);
            dos.close();
            int minStatusLength = (int) cos.written() + parent.checker.checksumLength();
            if(minStatusLength > statusLength)
View Full Code Here

Examples of freenet.support.io.NullOutputStream

            // Check hashes...
           
            DecompressorThreadManager decompressorManager = null;
            ClientGetWorkerThread worker = null;

            worker = new ClientGetWorkerThread(is, new NullOutputStream(), uri, null, hashes, false, null, ctx.prefetchHook, ctx.tagReplacer, context.linkFilterExceptionProvider);
            worker.start();
           
            if(logMINOR) Logger.minor(this, "Waiting for hashing, filtration, and writing to finish");
            worker.waitFinished();
           
View Full Code Here

Examples of freenet.support.io.NullOutputStream

    }

    private HashResult[] getHashes(LockableRandomAccessBuffer data) throws IOException {
        InputStream is = new RAFInputStream(data, 0, data.size());
        MultiHashInputStream hashStream = new MultiHashInputStream(is, HashType.SHA256.bitmask);
        FileUtil.copy(is, new NullOutputStream(), data.size());
        is.close();
        return hashStream.getResults();
    }
View Full Code Here

Examples of freenet.support.io.NullOutputStream

        this.crossCheckBlockCount = crossCheckBlocks;
        this.totalBlocks = dataBlockCount + crossCheckBlocks;
        segments = new SplitFileInserterSegmentStorage[totalBlocks];
        blockNumbers = new int[totalBlocks];
        try {
            CountedOutputStream cos = new CountedOutputStream(new NullOutputStream());
            DataOutputStream dos = new DataOutputStream(cos);
            innerStoreStatus(dos);
            dos.close();
            statusLength = (int) cos.written() + parent.checker.checksumLength();
        } catch (IOException e) {
View Full Code Here

Examples of freenet.support.io.NullOutputStream

            segments[i+dataBlockCount].setCrossCheckBlock(this, blockNumbers[i+dataBlockCount], i+dataBlockCount);
        }
        statusLength = dis.readInt();
        if(statusLength < 0) throw new StorageFormatException("Bogus status length");
        try {
            CountedOutputStream cos = new CountedOutputStream(new NullOutputStream());
            DataOutputStream dos = new DataOutputStream(cos);
            innerStoreStatus(dos);
            dos.close();
            int computedStatusLength = (int) cos.written() + parent.checker.checksumLength();
            if(computedStatusLength > statusLength)
View Full Code Here

Examples of freenet.support.io.NullOutputStream

    }
   
    private HashResult[] getHashes(LockableRandomAccessBuffer data) throws IOException {
        InputStream is = new RAFInputStream(data, 0, data.size());
        MultiHashInputStream hashStream = new MultiHashInputStream(is, HashType.SHA256.bitmask);
        FileUtil.copy(is, new NullOutputStream(), data.size());
        is.close();
        return hashStream.getResults();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.