Package freenet.support.io

Examples of freenet.support.io.CountedOutputStream


        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) {
            throw new Error(e); // Impossible
        }
    }
View Full Code Here


            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)
                throw new StorageFormatException("Stored status length smaller than required");
        } catch (IOException e) {
            throw new Error(e); // Impossible
        }
View Full Code Here

TOP

Related Classes of freenet.support.io.CountedOutputStream

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.