Examples of TNEFAttribute


Examples of org.apache.poi.hmef.attribute.TNEFAttribute

      } while (level != TNEFProperty.LEVEL_END_OF_FILE);
   }

   void processMessage(InputStream inp) throws IOException {
      // Build the attribute
      TNEFAttribute attr = TNEFAttribute.create(inp);

      messageAttributes.add(attr);

      if (attr instanceof TNEFMAPIAttribute) {
         TNEFMAPIAttribute tnefMAPI = (TNEFMAPIAttribute) attr;
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

      }
   }

   void processAttachment(InputStream inp) throws IOException {
      // Build the attribute
      TNEFAttribute attr = TNEFAttribute.create(inp);

      // Previous attachment or a new one?
      if (attachments.isEmpty()
         || attr.getProperty() == TNEFProperty.ID_ATTACHRENDERDATA) {
         attachments.add(new Attachment());
      }

      // Save the attribute for it
      Attachment attach = attachments.get(attachments.size() - 1);
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

         if(level == TNEFProperty.LEVEL_END_OF_FILE) {
            break;
         }
      
         // Build the attribute
         TNEFAttribute attr = TNEFAttribute.create(inp);
        
         // Is it a new attachment?
         if(level == TNEFProperty.LEVEL_ATTACHMENT &&
               attr.getProperty() == TNEFProperty.ID_ATTACHRENDERDATA) {
            attachments++;
            System.out.println();
            System.out.println("Attachment # " + attachments);
            System.out.println();
         }
        
         // Print the attribute into
         System.out.println(
               "Level " + level + " : Type " + attr.getType() +
               " : ID " + attr.getProperty().toString()
         );
        
         // Print the contents
         String indent = "  ";
        
         if(attr instanceof TNEFStringAttribute) {
            System.out.println(indent + indent + indent + ((TNEFStringAttribute)attr).getString());
         }
         if(attr instanceof TNEFDateAttribute) {
            System.out.println(indent + indent + indent + ((TNEFDateAttribute)attr).getDate());
         }
        
         System.out.println(indent + "Data of length " + attr.getData().length);
         if(attr.getData().length > 0) {
            int len = attr.getData().length;
            if(truncatePropertyData) {
               len = Math.min( attr.getData().length, 48 );
            }
           
            int loops = len/16;
            if(loops == 0) loops = 1;
           
            for(int i=0; i<loops; i++) {
               int thisLen = 16;
               int offset = i*16;
               if(i == loops-1) {
                  thisLen = len - offset;
               }

               byte data[] = new byte[thisLen];
               System.arraycopy(attr.getData(), offset, data, 0, thisLen);
              
               System.out.print(
                     indent + HexDump.dump(data, 0, 0)
               );
            }
         }
         System.out.println();
        
         if(attr.getProperty() == TNEFProperty.ID_MAPIPROPERTIES ||
               attr.getProperty() == TNEFProperty.ID_ATTACHMENT) {
            List<MAPIAttribute> attrs = MAPIAttribute.create(attr);
            for(MAPIAttribute ma : attrs) {
               System.out.println(indent + indent + ma);
            }
            System.out.println();
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

        assertTrue(bodyStr.contains("There are also two attachments."));
        assertEquals(2, tnefDat.getAttachments().size());
    }
   
    private String getEncoding(HMEFMessage tnefDat) {
        TNEFAttribute oemCP = tnefDat.getMessageAttribute(TNEFProperty.ID_OEMCODEPAGE);
        MAPIAttribute cpId = tnefDat.getMessageMAPIAttribute(MAPIProperty.INTERNET_CPID);
        int codePage = 1252;
        if (oemCP != null) {
            codePage = LittleEndian.getInt(oemCP.getData());
        } else if (cpId != null) {
            codePage =  LittleEndian.getInt(cpId.getData());
        }
        switch (codePage) {
        // see http://en.wikipedia.org/wiki/Code_page for more
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

      } while (level != TNEFProperty.LEVEL_END_OF_FILE);
   }

   void processMessage(InputStream inp) throws IOException {
      // Build the attribute
      TNEFAttribute attr = TNEFAttribute.create(inp);

      messageAttributes.add(attr);

      if (attr instanceof TNEFMAPIAttribute) {
         TNEFMAPIAttribute tnefMAPI = (TNEFMAPIAttribute) attr;
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

      }
   }

   void processAttachment(InputStream inp) throws IOException {
      // Build the attribute
      TNEFAttribute attr = TNEFAttribute.create(inp);

      // Previous attachment or a new one?
      if (attachments.isEmpty()
         || attr.getProperty() == TNEFProperty.ID_ATTACHRENDERDATA) {
         attachments.add(new Attachment());
      }

      // Save the attribute for it
      Attachment attach = attachments.get(attachments.size() - 1);
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

  
   /**
    * Returns the contents of the attachment.
    */
   public byte[] getContents() {
      TNEFAttribute contents = getAttribute(TNEFProperty.ID_ATTACHDATA);
      if(contents == null) {
         throw new IllegalArgumentException("Attachment corrupt - no Data section");
      }
      return contents.getData();
   }
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

   /**
    * Returns the Meta File rendered representation
    *  of the attachment, or null if not set.
    */
   public byte[] getRenderedMetaFile() {
      TNEFAttribute meta = getAttribute(TNEFProperty.ID_ATTACHMETAFILE);
      if(meta == null) return null;
      return meta.getData();
   }
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

      if(level == TNEFProperty.LEVEL_END_OF_FILE) {
         return;
      }
   
      // Build the attribute
      TNEFAttribute attr = TNEFAttribute.create(inp);
     
      // Decide what to attach it to, based on the levels and IDs
      if(level == TNEFProperty.LEVEL_MESSAGE) {
         messageAttributes.add(attr);
        
         if(attr instanceof TNEFMAPIAttribute) {
            TNEFMAPIAttribute tnefMAPI = (TNEFMAPIAttribute)attr;
            mapiAttributes.addAll( tnefMAPI.getMAPIAttributes() );
         }
      } else if(level == TNEFProperty.LEVEL_ATTACHMENT) {
         // Previous attachment or a new one?
         if(attachments.size() == 0 || attr.getProperty() == TNEFProperty.ID_ATTACHRENDERDATA) {
            attachments.add(new Attachment());
         }
        
         // Save the attribute for it
         Attachment attach = attachments.get(attachments.size()-1);
View Full Code Here

Examples of org.apache.poi.hmef.attribute.TNEFAttribute

         if(level == TNEFProperty.LEVEL_END_OF_FILE) {
            break;
         }
      
         // Build the attribute
         TNEFAttribute attr = TNEFAttribute.create(inp);
        
         // Is it a new attachment?
         if(level == TNEFProperty.LEVEL_ATTACHMENT &&
               attr.getProperty() == TNEFProperty.ID_ATTACHRENDERDATA) {
            attachments++;
            System.out.println();
            System.out.println("Attachment # " + attachments);
            System.out.println();
         }
        
         // Print the attribute into
         System.out.println(
               "Level " + level + " : Type " + attr.getType() +
               " : ID " + attr.getProperty().toString()
         );
        
         // Print the contents
         String indent = "  ";
        
         if(attr instanceof TNEFStringAttribute) {
            System.out.println(indent + indent + indent + ((TNEFStringAttribute)attr).getString());
         }
         if(attr instanceof TNEFDateAttribute) {
            System.out.println(indent + indent + indent + ((TNEFDateAttribute)attr).getDate());
         }
        
         System.out.println(indent + "Data of length " + attr.getData().length);
         if(attr.getData().length > 0) {
            int len = attr.getData().length;
            if(truncatePropertyData) {
               len = Math.min( attr.getData().length, 48 );
            }
           
            int loops = len/16;
            if(loops == 0) loops = 1;
           
            for(int i=0; i<loops; i++) {
               int thisLen = 16;
               int offset = i*16;
               if(i == loops-1) {
                  thisLen = len - offset;
               }

               byte data[] = new byte[thisLen];
               System.arraycopy(attr.getData(), offset, data, 0, thisLen);
              
               System.out.print(
                     indent + HexDump.dump(data, 0, 0)
               );
            }
         }
         System.out.println();
        
         if(attr.getProperty() == TNEFProperty.ID_MAPIPROPERTIES ||
               attr.getProperty() == TNEFProperty.ID_ATTACHMENT) {
            List<MAPIAttribute> attrs = MAPIAttribute.create(attr);
            for(MAPIAttribute ma : attrs) {
               System.out.println(indent + indent + ma);
            }
            System.out.println();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.