All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.serialization.util.SerializationBitSetConstant Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.alachisoft.ncache.serialization.util;

/**
 * @author numan_hanif
 */
public class SerializationBitSetConstant {

    public static final int Flattened = 1;
    public static final int Compressed = 2;
    public static final int WriteThru = 4;
    public static final int WriteBehind = 8;
    public static final int ReadThru = 16;
    public static final int LockItem = 64;
    public static final int Utf8Encoded = 32;
    public static final int BinaryData = 128;

    public static int getBitSetData(SerializationBitSet bits) {
//        int value = 0;
//        byte[] bytes = new byte[bits.length()/8+1];
//        for (int i=0; i= 0; i--) {
            if (bits.charAt(i) == '1') {
                value.SetBit((byte) (int) Math.pow(2, maxIndex - i));
            }
        }

        return value;
    }

    public static SerializationBitSet setBitSetData(int bits) {

        SerializationBitSet value = new SerializationBitSet();
        value.SetBit((byte) bits);
        return value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy