From 76c19d6545b78a12f67e77b731bd2fb830f9da68 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Mon, 9 Jul 2012 16:08:30 +0000 Subject: [PATCH] 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 --- .../poi/hsmf/datatypes/PropertyValue.java | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertyValue.java b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertyValue.java index 42c3887ded..1468c094d9 100644 --- a/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertyValue.java +++ b/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertyValue.java @@ -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); + } + } } -- 2.39.5