Class EscherArrayProperty

  • All Implemented Interfaces:
    Iterable<byte[]>, GenericRecord

    public final class EscherArrayProperty
    extends EscherComplexProperty
    implements Iterable<byte[]>
    Escher array properties are the most weird construction ever invented with all sorts of special cases. I'm hopeful I've got them all.
    • Constructor Detail

      • EscherArrayProperty

        public EscherArrayProperty​(EscherPropertyTypes type,
                                   boolean isBlipId,
                                   int complexSize)
        Create an instance of an escher array property. This constructor defaults to a 6 bytes header if the complexSize is 0.
        Parameters:
        type - the property type of the property id
        isBlipId - true, if it references a blip
        complexSize - the data size
    • Method Detail

      • setMaxRecordLength

        public static void setMaxRecordLength​(int length)
        Parameters:
        length - the max record length allowed for EscherArrayProperty
      • getMaxRecordLength

        public static int getMaxRecordLength()
        Returns:
        the max record length allowed for EscherArrayProperty
      • getNumberOfElementsInArray

        public int getNumberOfElementsInArray()
      • setNumberOfElementsInArray

        public void setNumberOfElementsInArray​(int numberOfElements)
      • getNumberOfElementsInMemory

        public int getNumberOfElementsInMemory()
      • setNumberOfElementsInMemory

        public void setNumberOfElementsInMemory​(int numberOfElements)
      • getSizeOfElements

        public short getSizeOfElements()
      • setSizeOfElements

        public void setSizeOfElements​(int sizeOfElements)
      • getElement

        public byte[] getElement​(int index)
      • setElement

        public void setElement​(int index,
                               byte[] element)
      • setArrayData

        public int setArrayData​(byte[] data,
                                int offset)
        We have this method because the way in which arrays in escher works is screwed for seemly arbitrary reasons. While most properties are fairly consistent and have a predictable array size, escher arrays have special cases.
        Parameters:
        data - The data array containing the escher array information
        offset - The offset into the array to start reading from.
        Returns:
        the number of bytes used by this complex property.
      • serializeSimplePart

        public int serializeSimplePart​(byte[] data,
                                       int pos)
        Serializes the simple part of this property. ie the first 6 bytes. Needs special code to handle the case when the size doesn't include the size of the header block
        Overrides:
        serializeSimplePart in class EscherComplexProperty
        Parameters:
        data - the buffer to write to
        pos - the starting position
        Returns:
        the length of the part