Class Binary

    • Constructor Detail

      • Binary

        public Binary()
    • Method Detail

      • keyValueReferenceCount

        public static long keyValueReferenceCount​(long elementCount)
      • keyValueBinaryLength

        public static long keyValueBinaryLength()
      • binaryListMinimumLength

        public static long binaryListMinimumLength()
      • binaryListMaximumLength

        public static long binaryListMaximumLength()
      • toBinaryListTotalByteLength

        public static long toBinaryListTotalByteLength​(long binaryListElementsByteLength)
      • toBinaryListContentByteLength

        public static long toBinaryListContentByteLength​(long binaryListTotalByteLength)
      • lengthLength

        public static int lengthLength()
        Returns:
        the length in bytes of a peristent item's length field (8 bytes).
      • isValidGapLength

        public static boolean isValidGapLength​(long gapLength)
      • isValidEntityLength

        public static boolean isValidEntityLength​(long entityLength)
      • entityHeaderLength

        public static int entityHeaderLength()
      • entityTotalLength

        public static long entityTotalLength​(long entityContentLength)
      • entityContentLength

        public static long entityContentLength​(long entityTotalLength)
      • toEntityContentOffset

        public static long toEntityContentOffset​(long entityOffset)
      • toBinaryListByteLengthOffset

        public static final long toBinaryListByteLengthOffset​(long binaryListOffset)
      • toBinaryListElementCountOffset

        public static final long toBinaryListElementCountOffset​(long binaryListOffset)
      • toBinaryListElementsOffset

        public static long toBinaryListElementsOffset​(long binaryListOffset)
      • objectIdByteLength

        public static int objectIdByteLength()
      • referenceBinaryLength

        public static long referenceBinaryLength​(long referenceCount)
      • calculateReferenceListTotalBinaryLength

        public static long calculateReferenceListTotalBinaryLength​(long count)
      • calculateStringListContentBinaryLength

        public static long calculateStringListContentBinaryLength​(String[] strings)
      • calculateBinaryLengthChars

        public static long calculateBinaryLengthChars​(long count)
      • getEntityLengthRawValue

        public static final long getEntityLengthRawValue​(long entityAddress)
      • getEntityTypeIdRawValue

        public static final long getEntityTypeIdRawValue​(long entityAddress)
      • getEntityObjectIdRawValue

        public static final long getEntityObjectIdRawValue​(long entityAddress)
      • isSwitchedByteOrder

        public boolean isSwitchedByteOrder()
      • getBuildItemTotalLength

        public final long getBuildItemTotalLength()
      • getBuildItemContentLength

        public final long getBuildItemContentLength()
      • getBuildItemTypeId

        public final long getBuildItemTypeId()
      • getBuildItemObjectId

        public final long getBuildItemObjectId()
      • storeEntityHeader

        public abstract void storeEntityHeader​(long entityContentLength,
                                               long entityTypeId,
                                               long entityObjectId)
      • getListElementCountKeyValue

        public final long getListElementCountKeyValue​(long listStartOffset)
      • read_byte

        public final byte read_byte​(long offset)
      • read_boolean

        public final boolean read_boolean​(long offset)
      • read_short

        public final short read_short​(long offset)
      • read_char

        public final char read_char​(long offset)
      • read_int

        public final int read_int​(long offset)
      • read_float

        public final float read_float​(long offset)
      • read_long

        public final long read_long​(long offset)
      • read_double

        public final double read_double​(long offset)
      • channelChunk

        public abstract Binary channelChunk​(int channelIndex)
      • channelCount

        public abstract int channelCount()
      • iterateChannelChunks

        public abstract void iterateChannelChunks​(Consumer<? super Binary> logic)
      • storeKeyValuesAsEntries

        public final void storeKeyValuesAsEntries​(long typeId,
                                                  long objectId,
                                                  long headerOffset,
                                                  Iterable<? extends KeyValue<?,​?>> keyValues,
                                                  long size,
                                                  PersistenceFunction persister)
      • storeMapEntrySet

        public final <K,​V> void storeMapEntrySet​(long typeId,
                                                       long objectId,
                                                       long headerOffset,
                                                       Set<Map.Entry<K,​V>> entrySet,
                                                       PersistenceFunction persister)
      • storeSizedArray

        public final void storeSizedArray​(long tid,
                                          long oid,
                                          long headerOffset,
                                          Object[] array,
                                          int size,
                                          PersistenceStoreHandler persister)
      • storeSizedArray

        public final void storeSizedArray​(long tid,
                                          long oid,
                                          long headerOffset,
                                          Object[] array,
                                          int offset,
                                          int size,
                                          PersistenceStoreHandler persister)
      • buildRootMapping

        public final <T extends XAddingMap<String,​Long>> T buildRootMapping​(T mapping)
      • storeIterableAsList

        public final void storeIterableAsList​(long tid,
                                              long oid,
                                              long headerOffset,
                                              Iterable<?> elements,
                                              long size,
                                              PersistenceFunction persister)
      • getSizedArrayElementCount

        public int getSizedArrayElementCount​(long headerOffset)
      • getSizedArrayLength

        public final int getSizedArrayLength​(long sizedArrayOffset)
      • getSizedArrayElementsAddress

        public final long getSizedArrayElementsAddress​(long headerOffset)
      • validateArrayLength

        public final void validateArrayLength​(Object[] array,
                                              long headerOffset)
      • getBinaryListTotalByteLength

        public final long getBinaryListTotalByteLength​(long listOffset)
      • getLoadItemAvailableContentLength

        public final long getLoadItemAvailableContentLength()
      • getBinaryListElementCountValidating

        public final long getBinaryListElementCountValidating​(long listOffset,
                                                              long elementLength)
      • getBinaryListElementCountUnvalidating

        public final long getBinaryListElementCountUnvalidating​(long listOffset)
      • getListElementCount

        public final long getListElementCount​(long listStartOffset,
                                              int elementLength)
      • getListElementCountReferences

        public final long getListElementCountReferences​(long listStartOffset)
      • iterateListStructureElements

        public final long iterateListStructureElements​(long listOffset,
                                                       BinaryElementReader reader)
        Iterates over all elements of a binary list. All elements must have the same binary length.
        Parameters:
        listOffset - the binary offset at which the binary list (actually: its header) starts
        reader - the reader logic to be used by the iteration.
        Returns:
        the element count that has been iterated.
      • iterateListElementReferences

        public final void iterateListElementReferences​(long listOffset,
                                                       PersistenceObjectIdAcceptor iterator)
      • iterateSizedArrayElementReferences

        public final void iterateSizedArrayElementReferences​(long offset,
                                                             PersistenceObjectIdAcceptor iterator)
      • iterateListStructureReferenceRange

        public final void iterateListStructureReferenceRange​(long listOffset,
                                                             int referencesPerElement,
                                                             PersistenceObjectIdAcceptor iterator)
      • iterateKeyValueEntriesReferences

        public final void iterateKeyValueEntriesReferences​(long listOffset,
                                                           PersistenceObjectIdAcceptor iterator)
      • iterateReferenceRange

        public final void iterateReferenceRange​(long startOffset,
                                                long boundOffset,
                                                PersistenceObjectIdAcceptor iterator)
      • iterateReferenceRangeUnvalidated

        public final void iterateReferenceRangeUnvalidated​(long startOffset,
                                                           long boundOffset,
                                                           PersistenceObjectIdAcceptor iterator)
      • store_bytes

        public final void store_bytes​(long typeId,
                                      long objectId,
                                      byte[] array)
      • store_booleans

        public final void store_booleans​(long typeId,
                                         long objectId,
                                         boolean[] array)
      • store_shorts

        public final void store_shorts​(long typeId,
                                       long objectId,
                                       short[] array)
      • store_chars

        public final void store_chars​(long typeId,
                                      long objectId,
                                      char[] array)
      • store_ints

        public final void store_ints​(long typeId,
                                     long objectId,
                                     int[] array)
      • store_floats

        public final void store_floats​(long typeId,
                                       long objectId,
                                       float[] array)
      • store_longs

        public final void store_longs​(long typeId,
                                      long objectId,
                                      long[] array)
      • store_doubles

        public final void store_doubles​(long typeId,
                                        long objectId,
                                        double[] array)
      • storeByte

        public final void storeByte​(long typeId,
                                    long objectId,
                                    byte value)
      • storeBoolean

        public final void storeBoolean​(long typeId,
                                       long objectId,
                                       boolean value)
      • storeShort

        public final void storeShort​(long typeId,
                                     long objectId,
                                     short value)
      • storeCharacter

        public final void storeCharacter​(long typeId,
                                         long objectId,
                                         char value)
      • storeInteger

        public final void storeInteger​(long typeId,
                                       long objectId,
                                       int value)
      • storeFloat

        public final void storeFloat​(long typeId,
                                     long objectId,
                                     float value)
      • storeLong

        public final void storeLong​(long typeId,
                                    long objectId,
                                    long value)
      • storeDouble

        public final void storeDouble​(long typeId,
                                      long objectId,
                                      double value)
      • storeStateless

        public final void storeStateless​(long typeId,
                                         long objectId)
      • storeStringValue

        public final void storeStringValue​(long typeId,
                                           long objectId,
                                           String string)
      • storeStringValue

        public final void storeStringValue​(long typeId,
                                           long objectId,
                                           char[] chars)
      • storeStringValue

        public final void storeStringValue​(long typeId,
                                           long objectId,
                                           char[] chars,
                                           int offset,
                                           int length)
      • storeReferences

        public final void storeReferences​(long typeId,
                                          long objectId,
                                          long binaryOffset,
                                          PersistenceStoreHandler idResolver,
                                          Object[] array)
      • storeReferences

        public final void storeReferences​(long typeId,
                                          long objectId,
                                          long binaryOffset,
                                          PersistenceStoreHandler idResolver,
                                          Object[] array,
                                          int arrayOffset,
                                          int arrayLength)
      • buildStrings

        public final String[] buildStrings​(long stringsListOffset)
      • buildByte

        public final Byte buildByte()
      • buildByte

        public final Byte buildByte​(long offset)
      • buildBoolean

        public final Boolean buildBoolean()
      • buildBoolean

        public final Boolean buildBoolean​(long offset)
      • buildShort

        public final Short buildShort()
      • buildShort

        public final Short buildShort​(long offset)
      • buildCharacter

        public final Character buildCharacter()
      • buildCharacter

        public final Character buildCharacter​(long offset)
      • buildInteger

        public final Integer buildInteger()
      • buildInteger

        public final Integer buildInteger​(long offset)
      • buildFloat

        public final Float buildFloat()
      • buildFloat

        public final Float buildFloat​(long offset)
      • buildLong

        public final Long buildLong()
      • buildLong

        public final Long buildLong​(long offset)
      • buildDouble

        public final Double buildDouble()
      • buildDouble

        public final Double buildDouble​(long offset)
      • buildPrimitiveWrapper

        public final Object buildPrimitiveWrapper​(Class<?> primitiveValueType)
      • buildPrimitiveWrapper

        public final Object buildPrimitiveWrapper​(Class<?> primitiveValueType,
                                                  long offset)
      • buildString

        public final String buildString()
      • create_bytes

        public final byte[] create_bytes()
      • create_bytes

        public final byte[] create_bytes​(long listOffset)
      • create_booleans

        public final boolean[] create_booleans()
      • create_booleans

        public final boolean[] create_booleans​(long listOffset)
      • create_shorts

        public final short[] create_shorts()
      • create_shorts

        public final short[] create_shorts​(long listOffset)
      • create_chars

        public final char[] create_chars()
      • create_chars

        public final char[] create_chars​(long listOffset)
      • create_ints

        public final int[] create_ints()
      • create_ints

        public final int[] create_ints​(long listOffset)
      • create_floats

        public final float[] create_floats()
      • create_floats

        public final float[] create_floats​(long listOffset)
      • create_longs

        public final long[] create_longs()
      • create_longs

        public final long[] create_longs​(long listOffset)
      • create_doubles

        public final double[] create_doubles()
      • create_doubles

        public final double[] create_doubles​(long listOffset)
      • build_bytes

        public final byte[] build_bytes()
      • build_bytes

        public final byte[] build_bytes​(long listOffset)
      • build_booleans

        public final boolean[] build_booleans()
      • build_booleans

        public final boolean[] build_booleans​(long listOffset)
      • build_shorts

        public final short[] build_shorts()
      • build_shorts

        public final short[] build_shorts​(long listOffset)
      • build_chars

        public final char[] build_chars()
      • build_chars

        public final char[] build_chars​(long listOffset)
      • build_ints

        public final int[] build_ints()
      • build_ints

        public final int[] build_ints​(long listOffset)
      • build_floats

        public final float[] build_floats()
      • build_floats

        public final float[] build_floats​(long listOffset)
      • build_longs

        public final long[] build_longs()
      • build_longs

        public final long[] build_longs​(long listOffset)
      • build_doubles

        public final double[] build_doubles()
      • build_doubles

        public final double[] build_doubles​(long listOffset)
      • collectElementsIntoArray

        public final void collectElementsIntoArray​(long binaryOffset,
                                                   PersistenceLoadHandler handler,
                                                   Object[] target)
      • storeCharsAsList

        public final long storeCharsAsList​(long memoryOffset,
                                           char[] chars,
                                           int offset,
                                           int length)
      • copyMemory

        public final void copyMemory​(ByteBuffer directByteBuffer,
                                     long offset,
                                     BinaryValueSetter[] setters,
                                     long[] targetOffsets)
      • storeListHeader

        public final void storeListHeader​(long offset,
                                          long elementsBinaryLength,
                                          long elementsCount)
      • storeIterableContentAsList

        public final void storeIterableContentAsList​(long offset,
                                                     PersistenceFunction persister,
                                                     Iterable<?> elements,
                                                     long elementCount)
      • storeStringsAsList

        public final void storeStringsAsList​(long memoryOffset,
                                             long precalculatedContentBinaryLength,
                                             String[] strings)
      • storeStringsAsList

        public final void storeStringsAsList​(long memoryOffset,
                                             long precalculatedContentBinaryLength,
                                             String[] strings,
                                             int offset,
                                             int length)
      • storeKeyValuesAsEntries

        public final void storeKeyValuesAsEntries​(long offset,
                                                  PersistenceFunction persister,
                                                  Iterable<? extends KeyValue<?,​?>> elements,
                                                  long elementCount)
      • storeReferencesAsList

        public final void storeReferencesAsList​(long memoryOffset,
                                                PersistenceStoreHandler persister,
                                                Object[] array,
                                                int offset,
                                                int length)
      • store_byte

        public final void store_byte​(long offset,
                                     byte value)
      • store_boolean

        public final void store_boolean​(long offset,
                                        boolean value)
      • store_short

        public final void store_short​(long offset,
                                      short value)
      • store_char

        public final void store_char​(long offset,
                                     char value)
      • store_int

        public final void store_int​(long offset,
                                    int value)
      • store_float

        public final void store_float​(long offset,
                                      float value)
      • store_long

        public final void store_long​(long offset,
                                     long value)
      • store_double

        public final void store_double​(long offset,
                                       double value)
      • store_byte

        public final void store_byte​(byte value)
      • store_boolean

        public final void store_boolean​(boolean value)
      • store_short

        public final void store_short​(short value)
      • store_char

        public final void store_char​(char value)
      • store_int

        public final void store_int​(int value)
      • store_float

        public final void store_float​(float value)
      • store_long

        public final void store_long​(long value)
      • store_double

        public final void store_double​(double value)
      • modifyLoadItem

        public abstract void modifyLoadItem​(ByteBuffer directByteBuffer,
                                            long offset,
                                            long entityTotalLength,
                                            long entityTypeId,
                                            long entityObjectId)
      • updateSizedArrayObjectReferences

        public final int updateSizedArrayObjectReferences​(long binaryOffset,
                                                          PersistenceLoadHandler handler,
                                                          Object[] array)
        Updates the passed array up to the size defined by the binary data, returns the size.
      • updateArrayObjectReferences1

        public final void updateArrayObjectReferences1​(long binaryListStartOffset,
                                                       PersistenceLoadHandler handler,
                                                       Object[] array)
      • updateArrayObjectReferences

        public final void updateArrayObjectReferences​(long binaryListStartOffset,
                                                      PersistenceLoadHandler handler,
                                                      Object[] array,
                                                      int arrayOffset,
                                                      int arrayLength)
      • update_bytes

        public final void update_bytes​(byte[] array)
      • update_bytes

        public final void update_bytes​(long offset,
                                       byte[] array)
      • update_booleans

        public final void update_booleans​(boolean[] array)
      • update_booleans

        public final void update_booleans​(long offset,
                                          boolean[] array)
      • update_shorts

        public final void update_shorts​(short[] array)
      • update_shorts

        public final void update_shorts​(long offset,
                                        short[] array)
      • update_chars

        public final void update_chars​(char[] array)
      • update_chars

        public final void update_chars​(long offset,
                                       char[] array)
      • update_ints

        public final void update_ints​(int[] array)
      • update_ints

        public final void update_ints​(long offset,
                                      int[] array)
      • update_floats

        public final void update_floats​(float[] array)
      • update_floats

        public final void update_floats​(long offset,
                                        float[] array)
      • update_longs

        public final void update_longs​(long[] array)
      • update_longs

        public final void update_longs​(long offset,
                                       long[] array)
      • update_doubles

        public final void update_doubles​(double[] array)
      • update_doubles

        public final void update_doubles​(long offset,
                                         double[] array)
      • registerHelper

        public final void registerHelper​(Object key,
                                         Object helper)
        Helper instances can be used as temporary additional state for the duration of the building process. E.g.: JDK hash collections cannot properly collect elements during the building process as the element instances might still be in an initialized state without their proper data, so hashing and equality comparisons would fail or result in all elements being "equal". So building JDK hash collections required to pre-collect their elements in an additional helper structure and defer the actual elements collecting to the completion.

        Similar problems with other or complex custom handlers are conceivable.

        Only one helper object can be registered per subject instance (the instance to be built).

      • getHelper

        public final Object getHelper​(Object key)
        Helper instances can be used as temporary additional state for the duration of the building process. E.g.: JDK hash collections cannot properly collect elements during the building process as the element instances might still be in an initialized state without their proper data, so hashing and equality comparisons would failt or result in all elements being "equal". So building JDK hash collections required to pre-collect their elements in an additional helper structure and defer the actual elements collecting to the completion.

        Similar problems with other or complex custom handlers are conceivable.