Class Binary

    • Constructor Detail

      • Binary

        public Binary()
    • Method Detail

      • keyValueReferenceCount

        public static final long keyValueReferenceCount​(long elementCount)
      • keyValueBinaryLength

        public static final long keyValueBinaryLength()
      • binaryListMinimumLength

        public static final long binaryListMinimumLength()
      • binaryListMaximumLength

        public static final long binaryListMaximumLength()
      • toBinaryListTotalByteLength

        public static final long toBinaryListTotalByteLength​(long binaryListElementsByteLength)
      • toBinaryListContentByteLength

        public static final long toBinaryListContentByteLength​(long binaryListTotalByteLength)
      • lengthLength

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

        public static final boolean isValidGapLength​(long gapLength)
      • isValidEntityLength

        public static final boolean isValidEntityLength​(long entityLength)
      • entityHeaderLength

        public static final int entityHeaderLength()
      • entityTotalLength

        public static final long entityTotalLength​(long entityContentLength)
      • entityContentLength

        public static final long entityContentLength​(long entityTotalLength)
      • isSwitchedByteOrder

        public boolean isSwitchedByteOrder()
      • getEntityLength

        public final long getEntityLength()
      • getEntityTypeId

        public final long getEntityTypeId()
      • getEntityObjectId

        public final long getEntityObjectId()
      • getEntityBoundAddress

        public final long getEntityBoundAddress()
      • getEntityLengthRawValue

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

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

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

        public static final long entityContentAddress​(long entityAddress)
      • objectIdByteLength

        public static final int objectIdByteLength()
      • entityAddressFromContentAddress

        public static final long entityAddressFromContentAddress​(long entityContentAddress)
      • getBuildItemContentLength

        public final long getBuildItemContentLength()
      • getBuildItemTypeId

        public final long getBuildItemTypeId()
      • getBuildItemObjectId

        public final long getBuildItemObjectId()
      • referenceBinaryLength

        public static final long referenceBinaryLength​(long referenceCount)
      • storeEntityHeader

        public abstract long storeEntityHeader​(long entityContentLength,
                                               long entityTypeId,
                                               long entityObjectId)
        Writes the header (etc...).

        Returns a memory address that is guaranteed to be safe for writing len bytes. Writing any more bytes will lead to unpredictable results, from (most likely) destroying the byte stream's consistency up to crashing the VM immediately or at some point in the future.

        DO NOT WRITE MORE THEN len BYTES TO THE RETURNED ADDRESS!

        Parameters:
        entityContentLength -
        entityTypeId -
        entityObjectId -
      • getListElementCountKeyValue

        public final long getListElementCountKeyValue​(long listStartOffset)
      • loadItemEntityContentAddress

        public abstract long loadItemEntityContentAddress()
      • loadItemEntityAddress

        public abstract long loadItemEntityAddress()
      • modifyLoadItem

        public abstract void modifyLoadItem​(long entityContentAddress,
                                            long entityTotalLength,
                                            long entityTypeId,
                                            long entityObjectId)
      • get_byte

        public final byte get_byte​(long offset)
      • get_boolean

        public final boolean get_boolean​(long offset)
      • get_short

        public final short get_short​(long offset)
      • get_char

        public final char get_char​(long offset)
      • get_int

        public final int get_int​(long offset)
      • get_float

        public final float get_float​(long offset)
      • get_long

        public final long get_long​(long offset)
      • get_double

        public final double get_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 long storeKeyValuesAsEntries​(long typeId,
                                                  long objectId,
                                                  long headerOffset,
                                                  Iterable<? extends KeyValue<?,​?>> keyValues,
                                                  long size,
                                                  PersistenceFunction persister)
      • storeMapEntrySet

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

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

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

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

        public int getSizedArrayElementCount​(long headerOffset)
      • updateSizedArrayObjectReferences

        public final int updateSizedArrayObjectReferences​(long headerOffset,
                                                          Object[] array,
                                                          PersistenceObjectIdResolver idResolver)
        Updates the passed array up to the size defined by the binary data, returns the size.
      • 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)
      • getBinaryListTotalByteLengthRawValue

        public static final long getBinaryListTotalByteLengthRawValue​(long binaryListAddress)
      • getLoadItemAvailableContentLength

        public final long getLoadItemAvailableContentLength()
      • getBinaryListElementCountValidating

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

        public final long getBinaryListElementCountUnvalidating​(long listOffset)
      • getBinaryListElementCountRawValue

        public static final long getBinaryListElementCountRawValue​(long binaryListAddress)
      • toBinaryListElementsAddress

        public static final long toBinaryListElementsAddress​(long binaryListAddress)
      • binaryListElementsAddress

        public final long binaryListElementsAddress​(long binaryListOffset)
      • getListElementCount

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

        public final long getListElementCountReferences​(long listStartOffset)
      • calculateReferenceListTotalBinaryLength

        public static final long calculateReferenceListTotalBinaryLength​(long count)
      • calculateStringListContentBinaryLength

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

        public static final long calculateBinaryLengthChars​(long count)
      • 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)
      • storeArray_byte

        public final void storeArray_byte​(long typeId,
                                          long objectId,
                                          byte[] array)
      • storeArray_boolean

        public final void storeArray_boolean​(long typeId,
                                             long objectId,
                                             boolean[] array)
      • storeArray_short

        public final void storeArray_short​(long typeId,
                                           long objectId,
                                           short[] array)
      • storeArray_char

        public final void storeArray_char​(long typeId,
                                          long objectId,
                                          char[] array)
      • storeArray_int

        public final void storeArray_int​(long typeId,
                                         long objectId,
                                         int[] array)
      • storeArray_float

        public final void storeArray_float​(long typeId,
                                           long objectId,
                                           float[] array)
      • storeArray_long

        public final void storeArray_long​(long typeId,
                                          long objectId,
                                          long[] array)
      • storeArray_double

        public final void storeArray_double​(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 long storeReferences​(long typeId,
                                          long objectId,
                                          long binaryOffset,
                                          PersistenceStoreHandler idResolver,
                                          Object[] array)
      • storeReferences

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

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

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

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

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

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

        public final long storeCharsAsList​(long storeAddress,
                                           char[] chars)
      • storeCharsAsList

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

        public final void storeCharsDirect​(long address,
                                           char[] chars,
                                           int offset,
                                           int length)
      • readCharsDirect

        public final void readCharsDirect​(long address,
                                          char[] chars,
                                          int offset,
                                          int length)
      • buildStrings

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

        public final Byte buildByte()
      • buildBoolean

        public final Boolean buildBoolean()
      • buildShort

        public final Short buildShort()
      • buildCharacter

        public final Character buildCharacter()
      • buildInteger

        public final Integer buildInteger()
      • buildFloat

        public final Float buildFloat()
      • buildLong

        public final Long buildLong()
      • buildDouble

        public final Double buildDouble()
      • buildArray_byte

        public final byte[] buildArray_byte()
      • createArray_byte

        public final byte[] createArray_byte()
      • updateArray_byte

        public final void updateArray_byte​(byte[] array)
      • createArray_boolean

        public final boolean[] createArray_boolean()
      • updateArray_boolean

        public final void updateArray_boolean​(boolean[] array)
      • createArray_short

        public final short[] createArray_short()
      • updateArray_short

        public final void updateArray_short​(short[] array)
      • createArray_char

        public final char[] createArray_char()
      • createArray_char

        public final char[] createArray_char​(long listOffset)
      • updateArray_char

        public final void updateArray_char​(char[] array)
      • buildString

        public final String buildString()
      • buildArray_char

        public final char[] buildArray_char()
      • buildArray_char

        public final char[] buildArray_char​(long listOffset)
      • createArray_int

        public final int[] createArray_int()
      • updateArray_int

        public final void updateArray_int​(int[] array)
      • createArray_float

        public final float[] createArray_float()
      • updateArray_float

        public final void updateArray_float​(float[] array)
      • createArray_long

        public final long[] createArray_long()
      • updateArray_long

        public final void updateArray_long​(long[] array)
      • createArray_double

        public final double[] createArray_double()
      • updateArray_double

        public final void updateArray_double​(double[] array)
      • updateArrayObjectReferences

        public final void updateArrayObjectReferences​(long binaryOffset,
                                                      PersistenceObjectIdResolver oidResolver,
                                                      Object[] array,
                                                      int arrayOffset,
                                                      int arrayLength)
      • store_byte

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

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

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

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

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

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

        public void store_long​(long address,
                               long value)
      • store_double

        public void store_double​(long address,
                                 double value)
      • read_bytes

        public final void read_bytes​(long address,
                                     byte[] target)
      • read_longs

        public void read_longs​(long address,
                               long[] target)
      • 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.