Top Description Fields Constructors Methods
org.apache.poi.ddf

public final Class EscherArrayProperty

extends EscherComplexProperty
implements Iterable<byte[]>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Imports
java.util.Iterator, .Map, .NoSuchElementException, .Spliterator, .Spliterators, java.util.function.Supplier, java.util.stream.Collectors, .StreamSupport, org.apache.poi.util.GenericRecordUtil, .IOUtils, .Internal, .LittleEndian, .Removal

Escher array properties are the most weird construction ever invented with all sorts of special cases. I'm hopeful I've got them all.

Field Summary

Modifier and TypeField and Description
private static final int
private final boolean
emptyComplexPart

When reading a property from data stream remember if the complex part is empty and set this flag.

private static final int
FIXED_SIZE

The size of the header that goes at the start of the array, before the data

private static int
private boolean
sizeIncludesHeaderSize

Normally, the size recorded in the simple data (for the complex data) includes the size of the header.

Constructor Summary

AccessConstructor and Description
public
EscherArrayProperty(short
The id consists of the property number, a flag indicating whether this is a blip id and a flag indicating that this is a complex property.
id
,
int
the data size
complexSize
)

Create an instance of an escher array property.

public
EscherArrayProperty(short
the property number part of the property id
propertyNumber
,
boolean
true, if it references a blip
isBlipId
,
byte[]
the data
complexData
)

Create an instance of an escher array property.

public
EscherArrayProperty(EscherPropertyTypes
the property type of the property id
type
,
boolean
true, if it references a blip
isBlipId
,
int
the data size
complexSize
)

Create an instance of an escher array property.

Method Summary

Modifier and TypeMethod and Description
private static int
getActualSizeOfElements(short sizeOfElements)

Sometimes the element size is stored as a negative number.

public byte[]
getElement(int index)

public Map<String, Supplier<?>>
public static int

Returns:

the max record length allowed for EscherArrayProperty
getMaxRecordLength
()

Hides org.apache.poi.ddf.EscherComplexProperty.getMaxRecordLength.

public int
public int
public short
public Iterator<byte[]>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

private void
rewriteArray(int numberOfElements, boolean copyToNewLen)

private static int
safeSize(int complexSize)

public int
serializeSimplePart(byte[]
the buffer to write to
data
,
int
the starting position
pos
)

Overrides org.apache.poi.ddf.EscherComplexProperty.serializeSimplePart.

Serializes the simple part of this property.

public int

Returns:

the number of bytes used by this complex property.
setArrayData
(byte[]
The data array containing the escher array information
data
,
int
The offset into the array to start reading from.
offset
)

We have this method because the way in which arrays in escher works is screwed for seemly arbitrary reasons.

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

public static void
setMaxRecordLength(int
the max record length allowed for EscherArrayProperty
length
)

Hides org.apache.poi.ddf.EscherComplexProperty.setMaxRecordLength.

public void
setNumberOfElementsInArray(int numberOfElements)

public void
setNumberOfElementsInMemory(int numberOfElements)

public void
setSizeOfElements(int sizeOfElements)

public Spliterator<byte[]>
spliterator()

Overrides default java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

Inherited from org.apache.poi.ddf.EscherComplexProperty:
equalsgetComplexDatagetPropertySizehashCoderesizeComplexDataresizeComplexDataserializeComplexPartsetComplexDatasetComplexData

Field Detail

DEFAULT_MAX_RECORD_LENGTHback to summary
private static final int DEFAULT_MAX_RECORD_LENGTH

Hides org.apache.poi.ddf.EscherComplexProperty.DEFAULT_MAX_RECORD_LENGTH.

emptyComplexPartback to summary
private final boolean emptyComplexPart

When reading a property from data stream remember if the complex part is empty and set this flag.

FIXED_SIZEback to summary
private static final int FIXED_SIZE

The size of the header that goes at the start of the array, before the data

MAX_RECORD_LENGTHback to summary
private static int MAX_RECORD_LENGTH

Hides org.apache.poi.ddf.EscherComplexProperty.MAX_RECORD_LENGTH.

sizeIncludesHeaderSizeback to summary
private boolean sizeIncludesHeaderSize

Normally, the size recorded in the simple data (for the complex data) includes the size of the header. There are a few cases when it doesn't though...

Constructor Detail

EscherArrayPropertyback to summary
public EscherArrayProperty(short id, int complexSize)

Create an instance of an escher array property. This constructor can be used to create emptyComplexParts with a complexSize = 0. Preferably use EscherArrayProperty(EscherPropertyTypes, boolean, int) with setComplexData(byte[]).

Parameters
id:short

The id consists of the property number, a flag indicating whether this is a blip id and a flag indicating that this is a complex property.

complexSize:int

the data size

Annotations
@Internal
EscherArrayPropertyback to summary
public EscherArrayProperty(short propertyNumber, boolean isBlipId, byte[] complexData)

Create an instance of an escher array property. This constructor defaults to a 6 bytes header if the complexData is null or byte[0].

Parameters
propertyNumber:short

the property number part of the property id

isBlipId:boolean

true, if it references a blip

complexData:byte[]

the data

Annotations
@Deprecated
@Removal
version:5.0.0
EscherArrayPropertyback to summary
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:EscherPropertyTypes

the property type of the property id

isBlipId:boolean

true, if it references a blip

complexSize:int

the data size

Method Detail

getActualSizeOfElementsback to summary
private static int getActualSizeOfElements(short sizeOfElements)

Sometimes the element size is stored as a negative number. We negate it and shift it to get the real value.

getElementback to summary
public byte[] getElement(int index)
getGenericPropertiesback to summary
public Map<String, Supplier<?>> getGenericProperties()

Overrides org.apache.poi.ddf.EscherComplexProperty.getGenericProperties.

Implements org.apache.poi.common.usermodel.GenericRecord.getGenericProperties.

Annotations
@Override
getMaxRecordLengthback to summary
public static int getMaxRecordLength()

Hides org.apache.poi.ddf.EscherComplexProperty.getMaxRecordLength.

Returns:int

the max record length allowed for EscherArrayProperty

getNumberOfElementsInArrayback to summary
public int getNumberOfElementsInArray()
getNumberOfElementsInMemoryback to summary
public int getNumberOfElementsInMemory()
getSizeOfElementsback to summary
public short getSizeOfElements()
iteratorback to summary
public Iterator<byte[]> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<byte[]>

an Iterator.

Annotations
@Override
rewriteArrayback to summary
private void rewriteArray(int numberOfElements, boolean copyToNewLen)
safeSizeback to summary
private static int safeSize(int complexSize)
serializeSimplePartback to summary
public int serializeSimplePart(byte[] data, int pos)

Overrides org.apache.poi.ddf.EscherComplexProperty.serializeSimplePart.

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

Parameters
data:byte[]

Doc from org.apache.poi.ddf.EscherProperty.serializeSimplePart.

the buffer to write to

pos:int

Doc from org.apache.poi.ddf.EscherProperty.serializeSimplePart.

the starting position

Returns:int

Doc from org.apache.poi.ddf.EscherProperty.serializeSimplePart.

the length of the part

Annotations
@Override
setArrayDataback to summary
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:byte[]

The data array containing the escher array information

offset:int

The offset into the array to start reading from.

Returns:int

the number of bytes used by this complex property.

setElementback to summary
public void setElement(int index, byte[] element)
setMaxRecordLengthback to summary
public static void setMaxRecordLength(int length)

Hides org.apache.poi.ddf.EscherComplexProperty.setMaxRecordLength.

Parameters
length:int

the max record length allowed for EscherArrayProperty

setNumberOfElementsInArrayback to summary
public void setNumberOfElementsInArray(int numberOfElements)
setNumberOfElementsInMemoryback to summary
public void setNumberOfElementsInMemory(int numberOfElements)
setSizeOfElementsback to summary
public void setSizeOfElements(int sizeOfElements)
spliteratorback to summary
public Spliterator<byte[]> spliterator()

Overrides default java.lang.Iterable.spliterator.

Doc from java.lang.Iterable.spliterator.

Creates a Spliterator over the elements described by this Iterable.

Returns:Spliterator<byte[]>

a Spliterator over the elements described by this Iterable.

Annotations
@Override
Since
POI 5.2.0