Package com.emc.vipr.transform.util

Examples of com.emc.vipr.transform.util.CountingInputStream


    private boolean closed;
    private byte[] uncompressedDigest;

    public DeflateInputFilter(InputStream in, int level) throws IOException {
        Deflater def = new Deflater(level);
        uncompressedCounter = new CountingInputStream(in);
        try {
            digester = new DigestInputStream(uncompressedCounter, MessageDigest.getInstance("SHA1"));
        } catch (NoSuchAlgorithmException e) {
            throw new IOException("Unable to initialize digest", e);
        }
        DeflaterInputStream deflateFilter = new DeflaterInputStream(digester, def);
        compressedCounter = new CountingInputStream(deflateFilter);
    }
View Full Code Here


        //
        // Filter chain:
        // user stream -> CountingInputStream(uncompressedSize) -> DigestInputStream ->
        // Encoder -> PipedOutputStream -> PipedInputStream ->
        // CountingInputStream(compressedSize)
        uncompressedSize = new CountingInputStream(in);
        try {
            uncompressedDigest = new DigestInputStream(uncompressedSize,
                    MessageDigest.getInstance("SHA1"));
        } catch (NoSuchAlgorithmException e) {
           throw new IOException("Could not create LZMACompessionFilter", e);
        }
        inputPipe = new PipedInputStream();
        outputPipe = new PipedOutputStream(inputPipe);
       
        compressedSize = new CountingInputStream(inputPipe);
        lzma = new Encoder();
        lzma.SetDictionarySize(compressionProfile.dictionarySize);
        lzma.SetNumFastBytes(compressionProfile.fastBytes);
        lzma.SetMatchFinder(compressionProfile.matchFinder);
        lzma.SetLcLpPb(compressionProfile.lc, compressionProfile.lp, compressionProfile.pb);
View Full Code Here

    public EncryptionInputFilter(InputStream in, Cipher cipher, MessageDigest digest) {
        // Construct the filter chain:
        // user stream->CountingInputStream->
        // DigestInputStream(optional)->CipherInputStream
        counterStream = new CountingInputStream(in);
        if(digest != null) {
            digestStream = new DigestInputStream(counterStream, digest);
            cipherStream = new CipherInputStream(digestStream, cipher);
        } else {
            cipherStream = new CipherInputStream(counterStream, cipher);
View Full Code Here

TOP

Related Classes of com.emc.vipr.transform.util.CountingInputStream

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.