import java.util.Map;
import org.apache.poi.hsmf.datatypes.PropertyValue.LongLongPropertyValue;
+import org.apache.poi.hsmf.datatypes.PropertyValue.LongPropertyValue;
+import org.apache.poi.hsmf.datatypes.PropertyValue.ShortPropertyValue;
import org.apache.poi.hsmf.datatypes.PropertyValue.TimePropertyValue;
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
import org.apache.poi.util.IOUtils;
// We'll match up the chunk later
propVal = new ChunkBasedPropertyValue(prop, flags, data);
}
+ else if (type == Types.SHORT) {
+ propVal = new ShortPropertyValue(prop, flags, data);
+ }
+ else if (type == Types.LONG) {
+ propVal = new LongPropertyValue(prop, flags, data);
+ }
else if (type == Types.LONG_LONG) {
propVal = new LongLongPropertyValue(prop, flags, data);
}
else if (type == Types.TIME) {
propVal = new TimePropertyValue(prop, flags, data);
}
- // TODO Add in the rest of the type
+ // TODO Add in the rest of the types
else {
propVal = new PropertyValue(prop, flags, data);
}
}
// TODO classes for the other important value types
+
+ public static class ShortPropertyValue extends PropertyValue {
+ public ShortPropertyValue(MAPIProperty property, long flags, byte[] data) {
+ super(property, flags, data);
+ }
+
+ public Short getValue() {
+ return LittleEndian.getShort(data);
+ }
+ public void setValue(short value) {
+ if (data.length != 2) {
+ data = new byte[2];
+ }
+ LittleEndian.putShort(data, 0, value);
+ }
+ }
+
+ public static class LongPropertyValue extends PropertyValue {
+ public LongPropertyValue(MAPIProperty property, long flags, byte[] data) {
+ super(property, flags, data);
+ }
+
+ public Integer getValue() {
+ return LittleEndian.getInt(data);
+ }
+ public void setValue(int value) {
+ if (data.length != 4) {
+ data = new byte[4];
+ }
+ LittleEndian.putInt(data, 0, value);
+ }
+ }
+
public static class LongLongPropertyValue extends PropertyValue {
public LongLongPropertyValue(MAPIProperty property, long flags, byte[] data) {
super(property, flags, data);