Search in sources :

Example 1 with MAPIValue

use of net.freeutils.tnef.MAPIValue in project zm-mailbox by Zimbra.

the class MapiPropertyId method getIntegerValue.

/**
     * Return the Integer value corresponding to a MAPI Property with value
     * PT_INT or PT_ERROR
     * @param schedView represents a TNEF which might contain a property with this
     * object's ID.
     * @return
     * @throws IOException
     */
public Integer getIntegerValue(SchedulingViewOfTnef schedView) throws IOException {
    MAPIValue mpValue = getFirstValue(schedView);
    if (mpValue == null) {
        return null;
    }
    Object obj = mpValue.getValue();
    if (obj == null) {
        return null;
    }
    if (obj instanceof Integer) {
        return (Integer) obj;
    }
    return null;
}
Also used : MAPIValue(net.freeutils.tnef.MAPIValue)

Example 2 with MAPIValue

use of net.freeutils.tnef.MAPIValue in project zm-mailbox by Zimbra.

the class MapiPropertyId method getBooleanValue.

public Boolean getBooleanValue(SchedulingViewOfTnef schedView) throws IOException {
    MAPIValue mpValue = getFirstValue(schedView);
    if (mpValue == null) {
        return null;
    }
    Object obj = mpValue.getValue();
    if (obj == null) {
        return null;
    }
    if (obj instanceof Boolean) {
        return (Boolean) obj;
    }
    return null;
}
Also used : MAPIValue(net.freeutils.tnef.MAPIValue)

Example 3 with MAPIValue

use of net.freeutils.tnef.MAPIValue in project zm-mailbox by Zimbra.

the class MapiPropertyId method getDoubleValue.

/**
     * Return the Double value corresponding to a MAPI Property with value
     * PT_DOUBLE
     * @param schedView represents a TNEF which might contain a property with this
     * object's ID.
     * @return
     * @throws IOException
     */
public Double getDoubleValue(SchedulingViewOfTnef schedView) throws IOException {
    MAPIValue mpValue = getFirstValue(schedView);
    if (mpValue == null) {
        return null;
    }
    Object obj = mpValue.getValue();
    if (obj == null) {
        return null;
    }
    if (obj instanceof Double) {
        return (Double) obj;
    }
    return null;
}
Also used : MAPIValue(net.freeutils.tnef.MAPIValue)

Example 4 with MAPIValue

use of net.freeutils.tnef.MAPIValue in project zm-mailbox by Zimbra.

the class MapiPropertyId method getByteArrayValue.

public byte[] getByteArrayValue(SchedulingViewOfTnef schedView) throws IOException {
    MAPIValue mpValue = getFirstValue(schedView);
    if (mpValue == null) {
        return null;
    }
    Object obj = mpValue.getValue();
    if (obj == null) {
        return null;
    }
    if (obj instanceof byte[]) {
        return (byte[]) obj;
    } else if (obj instanceof RawInputStream) {
        RawInputStream ris = (RawInputStream) obj;
        return ris.toByteArray();
    }
    return null;
}
Also used : RawInputStream(net.freeutils.tnef.RawInputStream) MAPIValue(net.freeutils.tnef.MAPIValue)

Example 5 with MAPIValue

use of net.freeutils.tnef.MAPIValue in project zm-mailbox by Zimbra.

the class MapiPropertyId method getStringValue.

public String getStringValue(SchedulingViewOfTnef schedView) throws IOException {
    MAPIValue mpValue = getFirstValue(schedView);
    if (mpValue == null) {
        return null;
    }
    Object obj;
    if (mpValue.getType() == MAPIProp.PT_STRING) {
        // Assume the value is in the OEM Code Page
        // The current MAPIValue code does not take account of that.
        RawInputStream ris = mpValue.getRawData();
        return IcalUtil.readString(ris, (int) ris.getLength(), schedView.getOEMCodePage());
    } else {
        // Probably PT_UNICODE_STRING but will accept anything whose value is
        // a String.
        obj = mpValue.getValue();
    }
    if (obj == null) {
        return null;
    }
    if (obj instanceof String) {
        return (String) obj;
    }
    return null;
}
Also used : RawInputStream(net.freeutils.tnef.RawInputStream) MAPIValue(net.freeutils.tnef.MAPIValue)

Aggregations

MAPIValue (net.freeutils.tnef.MAPIValue)7 RawInputStream (net.freeutils.tnef.RawInputStream)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1