use of net.freeutils.tnef.Attr in project zm-mailbox by Zimbra.
the class MapiPropertyId method getProp.
public MAPIProp getProp(SchedulingViewOfTnef schedView) throws IOException {
MAPIProp mp;
List<?> attribs = schedView.getAttributes();
for (Object thisObj : attribs) {
if (!(thisObj instanceof Attr)) {
continue;
}
Attr thisAtt = (Attr) thisObj;
Object o = thisAtt.getValue();
if (o == null) {
continue;
}
if (thisAtt.getID() != (Attr.attMAPIProps)) {
continue;
}
if (!(o instanceof MAPIProps)) {
return null;
}
MAPIProps thisPropset = (MAPIProps) o;
if (this.mapiPropName == null) {
mp = thisPropset.getProp(id);
} else {
mp = thisPropset.getProp(this.mapiPropName);
}
if (mp != null) {
return mp;
}
}
return null;
}
use of net.freeutils.tnef.Attr in project zm-mailbox by Zimbra.
the class SchedulingViewOfTnef method getMessageClass.
/**
* @return the value of the attMessageClass TNEF attribute
* @throws IOException
*/
public String getMessageClass() throws IOException {
if (messageClass != null) {
return messageClass;
}
Attr attMsgClass = getAttr(Attr.attMessageClass);
if (attMsgClass == null) {
return null;
}
messageClass = attMsgClass.getValue().toString();
return messageClass;
}
use of net.freeutils.tnef.Attr in project zm-mailbox by Zimbra.
the class SchedulingViewOfTnef method read.
/**
* Gathers scheduling related information from the TNEFInputStream.
*
* @param in the TNEFInputStream containing message data
* @throws IOException if an I/O error occurs
*/
@Override
protected void read(TNEFInputStream in) throws IOException {
Attr attr;
Attachment attachmnt = null;
while ((attr = in.readAttr()) != null) {
switch(attr.getLevel()) {
case Attr.LVL_ATTACHMENT:
switch(attr.getID()) {
case Attr.attAttachRenddata:
if (attachmnt != null) {
super.addAttachment(attachmnt);
}
attachmnt = new Attachment();
attachmnt.addAttribute(attr);
break;
case Attr.attAttachment:
MAPIProps mps = new MAPIProps((RawInputStream) attr.getValue());
attachmnt.setMAPIProps(mps);
break;
case Attr.attAttachData:
RawInputStream ris = (RawInputStream) attr.getValue();
attachmnt.setRawData(ris);
break;
case Attr.attAttachTransportFilename:
RawInputStream data = (RawInputStream) attr.getValue();
String filename = TNEFUtils.removeTerminatingNulls(new String(data.toByteArray(), super.getOEMCodePage()));
attachmnt.setFilename(filename);
break;
default:
attachmnt.addAttribute(attr);
break;
}
// switching on ID for LVL_ATTACHMENT
break;
case Attr.LVL_MESSAGE:
super.addAttribute(attr);
break;
default:
throw new IOException("Invalid attribute level: " + attr.getLevel());
}
// switch level
}
if (attachmnt != null) {
super.addAttachment(attachmnt);
}
}
Aggregations