Package co.paralleluniverse.common.io

Examples of co.paralleluniverse.common.io.Checksum


    private boolean writeData(CacheLine line, Persistable object) {
        if (object.size() > maxItemSize)
            throw new IllegalArgumentException("Object size is " + object.size() + " bytes and exceeds the limit of " + maxItemSize + " bytes: " + object);

        if (compareBeforeWrite) {
            final Checksum chksm = getChecksum();
            if (line.data != null && object.size() == line.data.remaining()) {
                final int n = line.data.remaining();

                chksm.update(line.data);
                line.data.rewind();
                final byte[] hash = chksm.getChecksum();

                object.write(line.data);
                line.data.flip();

                chksm.reset();
                chksm.update(line.data);
                line.data.rewind();

                if (!Arrays.equals(hash, chksm.getChecksum()))
                    return true;
                return false;
            }
        }
View Full Code Here


    private boolean writeData(CacheLine line, Persistable object) {
        if (object.size() > maxItemSize)
            throw new IllegalArgumentException("Object size is " + object.size() + " bytes and exceeds the limit of " + maxItemSize + " bytes.");

        if (compareBeforeWrite) {
            final Checksum chksm = getChecksum();
            if (line.data != null && object.size() == line.data.remaining()) {
                final int n = line.data.remaining();

                chksm.update(line.data);
                line.data.rewind();
                final byte[] hash = chksm.getChecksum();

                object.write(line.data);
                line.data.flip();

                chksm.reset();
                chksm.update(line.data);
                line.data.rewind();

                if (!Arrays.equals(hash, chksm.getChecksum()))
                    return true;
                return false;
            }
        }
View Full Code Here

    private boolean writeData(CacheLine line, Persistable object) {
        if (object.size() > maxItemSize)
            throw new IllegalArgumentException("Object size is " + object.size() + " bytes and exceeds the limit of " + maxItemSize + " bytes: " + object);

        if (compareBeforeWrite) {
            final Checksum chksm = getChecksum();
            if (line.data != null && object.size() == line.data.remaining()) {
                final int n = line.data.remaining();

                chksm.update(line.data);
                line.data.rewind();
                final byte[] hash = chksm.getChecksum();

                object.write(line.data);
                line.data.flip();

                chksm.reset();
                chksm.update(line.data);
                line.data.rewind();

                if (!Arrays.equals(hash, chksm.getChecksum()))
                    return true;
                return false;
            }
        }
View Full Code Here

    private boolean writeData(CacheLine line, Persistable object) {
        if (object.size() > maxItemSize)
            throw new IllegalArgumentException("Object size is " + object.size() + " bytes and exceeds the limit of " + maxItemSize + " bytes.");

        if (compareBeforeWrite) {
            final Checksum chksm = getChecksum();
            if (line.data != null && object.size() == line.data.remaining()) {
                final int n = line.data.remaining();

                chksm.update(line.data);
                line.data.rewind();
                final byte[] hash = chksm.getChecksum();

                object.write(line.data);
                line.data.flip();

                chksm.reset();
                chksm.update(line.data);
                line.data.rewind();

                if (!Arrays.equals(hash, chksm.getChecksum()))
                    return true;
                return false;
            }
        }
View Full Code Here

TOP

Related Classes of co.paralleluniverse.common.io.Checksum

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.