mirror of https://github.com/apache/poi.git
Provide one example of how PropertyValues can be encoded and decoded, rest still needed (along with logic in PropertiesChunk to drive it)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1359243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8789e74439
commit
76c19d6545
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.poi.hsmf.datatypes;
|
||||
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
|
||||
/**
|
||||
* An instance of a {@link MAPIProperty} inside a {@link PropertiesChunk}.
|
||||
* Where the {@link Types} type is a fixed length one, this will contain the
|
||||
|
@ -27,5 +29,47 @@ package org.apache.poi.hsmf.datatypes;
|
|||
public class PropertyValue {
|
||||
private MAPIProperty property;
|
||||
private long flags;
|
||||
private byte[] data;
|
||||
protected byte[] data;
|
||||
|
||||
public PropertyValue(MAPIProperty property, long flags, byte[] data) {
|
||||
this.property = property;
|
||||
this.flags = flags;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public MAPIProperty getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw value flags.
|
||||
* TODO Also provide getters for the flag meanings
|
||||
*/
|
||||
public long getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return data;
|
||||
}
|
||||
public void setRawValue(byte[] value) {
|
||||
this.data = value;
|
||||
}
|
||||
|
||||
// TODO classes for the other important value types
|
||||
public static class LongLongPropertyValue extends PropertyValue {
|
||||
public LongLongPropertyValue(MAPIProperty property, long flags, byte[] data) {
|
||||
super(property, flags, data);
|
||||
}
|
||||
|
||||
public Long getValue() {
|
||||
return LittleEndian.getLong(data);
|
||||
}
|
||||
public void setValue(long value) {
|
||||
if (data.length != 8) {
|
||||
data = new byte[8];
|
||||
}
|
||||
LittleEndian.putLong(data, 0, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue