Support decoding a few more property types
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1496988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5893c8c34
commit
b8644921c9
@ -26,6 +26,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.poi.hsmf.datatypes.PropertyValue.LongLongPropertyValue;
|
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.PropertyValue.TimePropertyValue;
|
||||||
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
|
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
@ -177,13 +179,19 @@ public abstract class PropertiesChunk extends Chunk {
|
|||||||
// We'll match up the chunk later
|
// We'll match up the chunk later
|
||||||
propVal = new ChunkBasedPropertyValue(prop, flags, data);
|
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) {
|
else if (type == Types.LONG_LONG) {
|
||||||
propVal = new LongLongPropertyValue(prop, flags, data);
|
propVal = new LongLongPropertyValue(prop, flags, data);
|
||||||
}
|
}
|
||||||
else if (type == Types.TIME) {
|
else if (type == Types.TIME) {
|
||||||
propVal = new TimePropertyValue(prop, flags, data);
|
propVal = new TimePropertyValue(prop, flags, data);
|
||||||
}
|
}
|
||||||
// TODO Add in the rest of the type
|
// TODO Add in the rest of the types
|
||||||
else {
|
else {
|
||||||
propVal = new PropertyValue(prop, flags, data);
|
propVal = new PropertyValue(prop, flags, data);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +73,39 @@ public class PropertyValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO classes for the other important value types
|
// 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 static class LongLongPropertyValue extends PropertyValue {
|
||||||
public LongLongPropertyValue(MAPIProperty property, long flags, byte[] data) {
|
public LongLongPropertyValue(MAPIProperty property, long flags, byte[] data) {
|
||||||
super(property, flags, data);
|
super(property, flags, data);
|
||||||
|
Loading…
Reference in New Issue
Block a user