Documentation of 'org.mapdb.BTreeKeySerializer' Java class
BTreeKeySerializer
org.mapdb

Class BTreeKeySerializer<KEY,KEYS>

  • Type Parameters:
    KEY - type of key
    KEYS - type of object which holds multiple keys (
    Direct Known Subclasses:
    BTreeKeySerializer.ArrayKeySerializer, BTreeKeySerializer.BasicKeySerializer, BTreeKeySerializer.Compress


    public abstract class BTreeKeySerializer<KEY,KEYS>
    extends java.lang.Object
    Custom serializer for BTreeMap keys which enables [Delta encoding](https://en.wikipedia.org/wiki/Delta_encoding). Keys in BTree Nodes are sorted, this enables number of tricks to save disk space. For example for numbers we may store only difference between subsequent numbers, for string we can only take suffix, etc...
    • Constructor Detail

      • BTreeKeySerializer

        public BTreeKeySerializer()
    • Method Detail

      • serialize

        public abstract void serialize(java.io.DataOutput out,
                                       KEYS keys)
                                throws java.io.IOException
        Serialize keys from single BTree Node.
        Parameters:
        out - output stream where to put ata
        keys - An object which represents keys
        Throws:
        java.io.IOException - in case of an writting error
      • deserialize

        public abstract KEYS deserialize(java.io.DataInput in,
                                         int nodeSize)
                                  throws java.io.IOException
        Deserializes keys for single BTree Node. To
        Parameters:
        in - input stream to read data from
        nodeSize - number of keys in deserialized node
        Returns:
        an object which represents keys
        Throws:
        java.io.IOException - in case of an reading error
      • compare

        public abstract int compare(KEYS keys,
                                    int pos1,
                                    int pos2)
      • compare

        public abstract int compare(KEYS keys,
                                    int pos,
                                    KEY key)
      • compareIsSmaller

        public boolean compareIsSmaller(KEYS keys,
                                        int pos,
                                        KEY key)
      • getKey

        public abstract KEY getKey(KEYS keys,
                                   int pos)
      • comparator

        public abstract java.util.Comparator<?> comparator()
      • emptyKeys

        public abstract KEYS emptyKeys()
      • length

        public abstract int length(KEYS keys)
      • putKey

        public abstract KEYS putKey(KEYS keys,
                                    int pos,
                                    KEY newKey)
        expand keys array by one and put newKey at position pos
        Parameters:
        keys - array of keys to put new key into
        pos - of new key
        newKey - new key to insert
        Returns:
        array of keys with new key at given position
      • copyOfRange

        public abstract KEYS copyOfRange(KEYS keys,
                                         int from,
                                         int to)
      • deleteKey

        public abstract KEYS deleteKey(KEYS keys,
                                       int pos)
      • findChildren

        public int findChildren(BTreeMap.BNode node,
                                java.lang.Object key)
        Find the first children node with a key equal or greater than the given key. If all items are smaller it returns keyser.length(keys)
        Parameters:
        node - BTree Node to find position in
        key - key whose position needs to be find
        Returns:
        position of key in node
      • findChildren2

        public int findChildren2(BTreeMap.BNode node,
                                 java.lang.Object key)
      • arrayToKeys

        public abstract KEYS arrayToKeys(java.lang.Object[] keys)
      • keysToArray

        public java.lang.Object[] keysToArray(KEYS keys)
      • isTrusted

        public boolean isTrusted()

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.