You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/12/10 23:35:12 UTC

svn commit: r1773544 [1/3] - /poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/

Author: kiwiwings
Date: Sat Dec 10 23:35:12 2016
New Revision: 1773544

URL: http://svn.apache.org/viewvc?rev=1773544&view=rev
Log:
reindent code - prepare for cleanups

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ByteChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkBasedPropertyValue.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroup.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroupWithProperties.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MAPIProperty.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessagePropertiesChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessageSubmissionChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/NameIdChunks.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertyValue.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/RecipientChunks.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StoragePropertiesChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Types.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/AttachmentChunks.java Sat Dec 10 23:35:12 2016
@@ -34,134 +34,132 @@ import org.apache.poi.util.POILogFactory
 import org.apache.poi.util.POILogger;
 
 /**
- * Collection of convenience chunks for standard parts of the MSG file attachment.
+ * Collection of convenience chunks for standard parts of the MSG file
+ * attachment.
  */
 public class AttachmentChunks implements ChunkGroup {
-   private static POILogger logger = POILogFactory.getLogger(AttachmentChunks.class);
-   public static final String PREFIX = "__attach_version1.0_#";
-   
-   public ByteChunk attachData;
-   public StringChunk attachExtension;
-   public StringChunk attachFileName;
-   public StringChunk attachLongFileName;
-   public StringChunk attachMimeTag;
-   public DirectoryChunk attachmentDirectory;
-   
-   /** 
-    * This is in WMF Format. You'll probably want to pass it
-    *  to Apache Batik to turn it into a SVG that you can
-    *  then display. 
-    */
-   public ByteChunk attachRenderingWMF;
-   
-   /**
-    * What the POIFS name of this attachment is.
-    */
-   private String poifsName;
-
-   /** Holds all the chunks that were found. */
-   private List<Chunk> allChunks = new ArrayList<Chunk>();
-
-   
-   public AttachmentChunks(String poifsName) {
-      this.poifsName = poifsName;
-   }
-   
-   
-   /**
-    * Is this Attachment an embedded MAPI message?
-    */
-   public boolean isEmbeddedMessage() {
-      return (attachmentDirectory != null);
-   }
-   /**
-    * Returns the embedded MAPI message, if the attachment
-    *  is an embedded message, or null otherwise
-    */
-   public MAPIMessage getEmbeddedMessage() throws IOException {
-      if (attachmentDirectory != null) {
-         return attachmentDirectory.getAsEmbededMessage();
-      }
-      return null;
-   }
-   
-   /**
-    * Returns the embedded object, if the attachment is an
-    *  object based embedding (image, document etc), or null
-    *  if it's an embedded message
-    */
-   public byte[] getEmbeddedAttachmentObject() {
-      if (attachData != null) {
-         return attachData.getValue();
-      }
-      return null;
-   }
-   
-   public Chunk[] getAll() {
-      return allChunks.toArray(new Chunk[allChunks.size()]);
-   }
-   public Chunk[] getChunks() {
-      return getAll();
-   }
-   
-   public String getPOIFSName() {
-      return poifsName;
-   }
-   
-   /**
-    * Called by the parser whenever a chunk is found.
-    */
-   public void record(Chunk chunk) {
-      // TODO: add further members for other properties like:
-      // - ATTACH_ADDITIONAL_INFO
-      // - ATTACH_CONTENT_BASE
-      // - ATTACH_CONTENT_LOCATION
-      // - ATTACH_DISPOSITION
-      // - ATTACH_ENCODING
-      // - ATTACH_FLAGS
-      // - ATTACH_LONG_PATHNAME
-      // - ATTACH_SIZE
-      final int chunkId = chunk.getChunkId();
-      if (chunkId == ATTACH_DATA.id) {
-         if(chunk instanceof ByteChunk) {
-             attachData = (ByteChunk)chunk;
-         } else if(chunk instanceof DirectoryChunk) {
-             attachmentDirectory = (DirectoryChunk)chunk;
-         } else {
-        	 logger.log(POILogger.ERROR, "Unexpected data chunk of type " + chunk);
-         }
-      } else if(chunkId == ATTACH_EXTENSION.id) {
-         attachExtension = (StringChunk)chunk;
-      } else if(chunkId == ATTACH_FILENAME.id) {
-         attachFileName = (StringChunk)chunk;
-      } else if(chunkId == ATTACH_LONG_FILENAME.id) {
-         attachLongFileName = (StringChunk)chunk;
-      } else if(chunkId == ATTACH_MIME_TAG.id) {
-         attachMimeTag = (StringChunk)chunk;
-      } else if(chunkId == ATTACH_RENDERING.id) {
-         attachRenderingWMF = (ByteChunk)chunk;
-      }
-
-      // And add to the main list
-      allChunks.add(chunk);
-   }
-
-   /**
-    * Used to flag that all the chunks of the attachment
-    *  have now been located.
-    */
-   public void chunksComplete() {
-      // Currently, we don't need to do anything special once
-      //  all the chunks have been located
-   }
-
-
-   /**
-    * Orders by the attachment number.
-    */
-   public static class AttachmentChunksSorter implements Comparator<AttachmentChunks>, Serializable {
-      public int compare(AttachmentChunks a, AttachmentChunks b) {
-         return a.poifsName.compareTo(b.poifsName);
-      }
-   }
+    private static POILogger logger = POILogFactory.getLogger(AttachmentChunks.class);
+    public static final String PREFIX = "__attach_version1.0_#";
+
+    public ByteChunk attachData;
+    public StringChunk attachExtension;
+    public StringChunk attachFileName;
+    public StringChunk attachLongFileName;
+    public StringChunk attachMimeTag;
+    public DirectoryChunk attachmentDirectory;
+
+    /**
+     * This is in WMF Format. You'll probably want to pass it to Apache Batik to
+     * turn it into a SVG that you can then display.
+     */
+    public ByteChunk attachRenderingWMF;
+
+    /**
+     * What the POIFS name of this attachment is.
+     */
+    private String poifsName;
+
+    /** Holds all the chunks that were found. */
+    private List<Chunk> allChunks = new ArrayList<Chunk>();
+
+    public AttachmentChunks(String poifsName) {
+        this.poifsName = poifsName;
+    }
+
+    /**
+     * Is this Attachment an embedded MAPI message?
+     */
+    public boolean isEmbeddedMessage() {
+        return (attachmentDirectory != null);
+    }
+
+    /**
+     * Returns the embedded MAPI message, if the attachment is an embedded
+     * message, or null otherwise
+     */
+    public MAPIMessage getEmbeddedMessage() throws IOException {
+        if (attachmentDirectory != null) {
+            return attachmentDirectory.getAsEmbededMessage();
+        }
+        return null;
+    }
+
+    /**
+     * Returns the embedded object, if the attachment is an object based
+     * embedding (image, document etc), or null if it's an embedded message
+     */
+    public byte[] getEmbeddedAttachmentObject() {
+        if (attachData != null) {
+            return attachData.getValue();
+        }
+        return null;
+    }
+
+    public Chunk[] getAll() {
+        return allChunks.toArray(new Chunk[allChunks.size()]);
+    }
+
+    public Chunk[] getChunks() {
+        return getAll();
+    }
+
+    public String getPOIFSName() {
+        return poifsName;
+    }
+
+    /**
+     * Called by the parser whenever a chunk is found.
+     */
+    public void record(Chunk chunk) {
+        // TODO: add further members for other properties like:
+        // - ATTACH_ADDITIONAL_INFO
+        // - ATTACH_CONTENT_BASE
+        // - ATTACH_CONTENT_LOCATION
+        // - ATTACH_DISPOSITION
+        // - ATTACH_ENCODING
+        // - ATTACH_FLAGS
+        // - ATTACH_LONG_PATHNAME
+        // - ATTACH_SIZE
+        final int chunkId = chunk.getChunkId();
+        if (chunkId == ATTACH_DATA.id) {
+            if (chunk instanceof ByteChunk) {
+                attachData = (ByteChunk) chunk;
+            } else if (chunk instanceof DirectoryChunk) {
+                attachmentDirectory = (DirectoryChunk) chunk;
+            } else {
+                logger.log(POILogger.ERROR, "Unexpected data chunk of type " + chunk);
+            }
+        } else if (chunkId == ATTACH_EXTENSION.id) {
+            attachExtension = (StringChunk) chunk;
+        } else if (chunkId == ATTACH_FILENAME.id) {
+            attachFileName = (StringChunk) chunk;
+        } else if (chunkId == ATTACH_LONG_FILENAME.id) {
+            attachLongFileName = (StringChunk) chunk;
+        } else if (chunkId == ATTACH_MIME_TAG.id) {
+            attachMimeTag = (StringChunk) chunk;
+        } else if (chunkId == ATTACH_RENDERING.id) {
+            attachRenderingWMF = (ByteChunk) chunk;
+        }
+
+        // And add to the main list
+        allChunks.add(chunk);
+    }
+
+    /**
+     * Used to flag that all the chunks of the attachment have now been located.
+     */
+    public void chunksComplete() {
+        // Currently, we don't need to do anything special once
+        // all the chunks have been located
+    }
+
+    /**
+     * Orders by the attachment number.
+     */
+    public static class AttachmentChunksSorter
+            implements Comparator<AttachmentChunks>, Serializable {
+        public int compare(AttachmentChunks a, AttachmentChunks b) {
+            return a.poifsName.compareTo(b.poifsName);
+        }
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ByteChunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ByteChunk.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ByteChunk.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ByteChunk.java Sat Dec 10 23:35:12 2016
@@ -24,89 +24,87 @@ import org.apache.poi.hsmf.datatypes.Typ
 import org.apache.poi.util.IOUtils;
 
 /**
- * A Chunk that holds binary data, normally unparsed.
- * Generally as we know how to make sense of the
- *  contents, we create a new Chunk class and add
- *  a special case in the parser for them.
+ * A Chunk that holds binary data, normally unparsed. Generally as we know how
+ * to make sense of the contents, we create a new Chunk class and add a special
+ * case in the parser for them.
  */
 
 public class ByteChunk extends Chunk {
-   private byte[] value;
+    private byte[] value;
 
-   /**
-    * Creates a Byte Chunk.
-    */
-   public ByteChunk(String namePrefix, int chunkId, MAPIType type) {
-      super(namePrefix, chunkId, type);
-   }
-   /**
-    * Create a Byte Chunk, with the specified
-    *  type.
-    */
-   public ByteChunk(int chunkId, MAPIType type) {
-      super(chunkId, type);
-   }
-
-   public void readValue(InputStream value) throws IOException {
-      this.value = IOUtils.toByteArray(value);
-   }
-
-   public void writeValue(OutputStream out) throws IOException {
-      out.write(value);
-   }
-
-   public byte[] getValue() {
-      return value;
-   }
-   public void setValue(byte[] value) {
-      this.value = value;
-   }
-   
-   /**
-    * Returns the data in a debug-friendly string format
-    */
-   public String toString() {
-       return toDebugFriendlyString(value);
-   }
-   
-   /**
-    * Formats the byte array in a debug-friendly way,
-    *  showing all of a short array, and the start of a 
-    *  longer one.
-    */
-   protected static String toDebugFriendlyString(byte[] value) {
-      if (value == null)
-         return "(Null Byte Array)";
-          
-      StringBuffer text = new StringBuffer();
-      text.append("Bytes len=").append(value.length);
-      text.append(" [");
-      
-      int limit = Math.min(value.length, 16);
-      if (value.length > 16) {
-          limit = 12;
-      }
-      for (int i=0; i<limit; i++) {
-          if (i > 0)
-              text.append(',');
-          text.append(value[i]);
-      }
-      if (value.length > 16) {
-          text.append(",....");
-      }
-      text.append("]");
-      return text.toString();
-   }
-   
-   /**
-    * Returns the data, formatted as a string assuming it
-    *  was a non-unicode string.
-    * If your data isn't in fact stored as basically
-    *  ASCII, don't expect this to return much of any
-    *  sense.... 
-    * @return  the data formatted as a string
-    */
-   public String getAs7bitString() {
-      return StringChunk.parseAs7BitData(value);
-   }
+    /**
+     * Creates a Byte Chunk.
+     */
+    public ByteChunk(String namePrefix, int chunkId, MAPIType type) {
+        super(namePrefix, chunkId, type);
+    }
+
+    /**
+     * Create a Byte Chunk, with the specified type.
+     */
+    public ByteChunk(int chunkId, MAPIType type) {
+        super(chunkId, type);
+    }
+
+    public void readValue(InputStream value) throws IOException {
+        this.value = IOUtils.toByteArray(value);
+    }
+
+    public void writeValue(OutputStream out) throws IOException {
+        out.write(value);
+    }
+
+    public byte[] getValue() {
+        return value;
+    }
+
+    public void setValue(byte[] value) {
+        this.value = value;
+    }
+
+    /**
+     * Returns the data in a debug-friendly string format
+     */
+    public String toString() {
+        return toDebugFriendlyString(value);
+    }
+
+    /**
+     * Formats the byte array in a debug-friendly way, showing all of a short
+     * array, and the start of a longer one.
+     */
+    protected static String toDebugFriendlyString(byte[] value) {
+        if (value == null)
+            return "(Null Byte Array)";
+
+        StringBuffer text = new StringBuffer();
+        text.append("Bytes len=").append(value.length);
+        text.append(" [");
+
+        int limit = Math.min(value.length, 16);
+        if (value.length > 16) {
+            limit = 12;
+        }
+        for (int i = 0; i < limit; i++) {
+            if (i > 0)
+                text.append(',');
+            text.append(value[i]);
+        }
+        if (value.length > 16) {
+            text.append(",....");
+        }
+        text.append("]");
+        return text.toString();
+    }
+
+    /**
+     * Returns the data, formatted as a string assuming it was a non-unicode
+     * string. If your data isn't in fact stored as basically ASCII, don't
+     * expect this to return much of any sense....
+     * 
+     * @return the data formatted as a string
+     */
+    public String getAs7bitString() {
+        return StringChunk.parseAs7BitData(value);
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunk.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunk.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunk.java Sat Dec 10 23:35:12 2016
@@ -25,55 +25,59 @@ import java.util.Locale;
 import org.apache.poi.hsmf.datatypes.Types.MAPIType;
 
 public abstract class Chunk {
-   public static final String DEFAULT_NAME_PREFIX = "__substg1.0_";
-   
-   protected int chunkId;
-   protected MAPIType type;
-   protected String namePrefix;
-	
-   protected Chunk(String namePrefix, int chunkId, MAPIType type) {
-      this.namePrefix = namePrefix;
-      this.chunkId = chunkId;
-      this.type = type;
-   }
-   protected Chunk(int chunkId, MAPIType type) {
-       this(DEFAULT_NAME_PREFIX, chunkId, type);
-   }
-
-   /**
-    * Gets the id of this chunk
-    */
-   public int getChunkId() {
-       return this.chunkId;
-   }
-
-   /**
-    * Gets the numeric type of this chunk.
-    */
-   public MAPIType getType() {
-       return this.type;
-   }
-
-   /**
-    * Creates a string to use to identify this chunk in the POI file system object.
-    */
-   public String getEntryName() {
-       String type = this.type.asFileEnding();
-
-       String chunkId = Integer.toHexString(this.chunkId);
-       while(chunkId.length() < 4) chunkId = "0" + chunkId;
-
-       return this.namePrefix + chunkId.toUpperCase(Locale.ROOT)
-              + type.toUpperCase(Locale.ROOT);
-   }
-
-   /**
-    * Writes the value of this chunk back out again.
-    */
-   public abstract void writeValue(OutputStream out) throws IOException;
-
-   /**
-    * Reads the value of this chunk using an InputStream
-    */
-   public abstract void readValue(InputStream value) throws IOException;
+    public static final String DEFAULT_NAME_PREFIX = "__substg1.0_";
+
+    protected int chunkId;
+    protected MAPIType type;
+    protected String namePrefix;
+
+    protected Chunk(String namePrefix, int chunkId, MAPIType type) {
+        this.namePrefix = namePrefix;
+        this.chunkId = chunkId;
+        this.type = type;
+    }
+
+    protected Chunk(int chunkId, MAPIType type) {
+        this(DEFAULT_NAME_PREFIX, chunkId, type);
+    }
+
+    /**
+     * Gets the id of this chunk
+     */
+    public int getChunkId() {
+        return this.chunkId;
+    }
+
+    /**
+     * Gets the numeric type of this chunk.
+     */
+    public MAPIType getType() {
+        return this.type;
+    }
+
+    /**
+     * Creates a string to use to identify this chunk in the POI file system
+     * object.
+     */
+    public String getEntryName() {
+        String type = this.type.asFileEnding();
+
+        String chunkId = Integer.toHexString(this.chunkId);
+        while (chunkId.length() < 4)
+            chunkId = "0" + chunkId;
+
+        return this.namePrefix
+            + chunkId.toUpperCase(Locale.ROOT)
+            + type.toUpperCase(Locale.ROOT);
+    }
+
+    /**
+     * Writes the value of this chunk back out again.
+     */
+    public abstract void writeValue(OutputStream out) throws IOException;
+
+    /**
+     * Reads the value of this chunk using an InputStream
+     */
+    public abstract void readValue(InputStream value) throws IOException;
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkBasedPropertyValue.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkBasedPropertyValue.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkBasedPropertyValue.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkBasedPropertyValue.java Sat Dec 10 23:35:12 2016
@@ -17,28 +17,26 @@
 
 package org.apache.poi.hsmf.datatypes;
 
-
 /**
- * A variable length {@link PropertyValue} that is
- *  backed by a {@link Chunk}
+ * A variable length {@link PropertyValue} that is backed by a {@link Chunk}
  * TODO Provide a way to link these up with the chunks
  */
 public class ChunkBasedPropertyValue extends PropertyValue {
-   public ChunkBasedPropertyValue(MAPIProperty property, long flags, byte[] offsetData) {
-      super(property, flags, offsetData);
-   }
+    public ChunkBasedPropertyValue(MAPIProperty property, long flags, byte[] offsetData) {
+        super(property, flags, offsetData);
+    }
+
+    @Override
+    public Chunk getValue() {
+        // TODO Decode the value into an offset
+        // TODO Look up the chunk based on that
+        return null;
+    }
 
-   @Override
-   public Chunk getValue() {
-      // TODO Decode the value into an offset
-      // TODO Look up the chunk based on that
-      return null;
-   }
-   
-   /**
-    * Stores the offset of the chunk as the property value
-    */
-   public void setValue(Chunk chunk) {
-      // TODO
-   }
+    /**
+     * Stores the offset of the chunk as the property value
+     */
+    public void setValue(Chunk chunk) {
+        // TODO
+    }
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroup.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroup.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroup.java Sat Dec 10 23:35:12 2016
@@ -18,15 +18,13 @@
 package org.apache.poi.hsmf.datatypes;
 
 /**
- * A group of chunks, that are at the same point in the
- *  file structure.
+ * A group of chunks, that are at the same point in the file structure.
  */
 public interface ChunkGroup {
-   /**
-    * Returns the chunks that make up the group.
-    * Should certainly contain all the interesting Chunks,
-    *  but needn't always contain all of the Chunks.
-    */
+    /**
+     * Returns the chunks that make up the group. Should certainly contain all
+     * the interesting Chunks, but needn't always contain all of the Chunks.
+     */
     public Chunk[] getChunks();
 
     /**

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroupWithProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroupWithProperties.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroupWithProperties.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroupWithProperties.java Sat Dec 10 23:35:12 2016
@@ -21,18 +21,15 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * A group of chunks which is indexable by {@link MAPIProperty}
- *  entries.
+ * A group of chunks which is indexable by {@link MAPIProperty} entries.
  */
 public interface ChunkGroupWithProperties extends ChunkGroup {
-   /**
-    * Returns all the Properties contained in the Chunk, along
-    *  with their Values.
-    * Normally, each property will have one value, sometimes
-    *  none, and rarely multiple (normally for Unknown etc).
-    * For fixed sized properties, the value can be fetched 
-    *  straight from the {@link PropertyValue}. For variable
-    *  sized properties, you'll need to go via the chunk.
-    */
-   public Map<MAPIProperty,List<PropertyValue>> getProperties();
+    /**
+     * Returns all the Properties contained in the Chunk, along with their
+     * Values. Normally, each property will have one value, sometimes none, and
+     * rarely multiple (normally for Unknown etc). For fixed sized properties,
+     * the value can be fetched straight from the {@link PropertyValue}. For
+     * variable sized properties, you'll need to go via the chunk.
+     */
+    public Map<MAPIProperty, List<PropertyValue>> getProperties();
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java Sat Dec 10 23:35:12 2016
@@ -26,169 +26,158 @@ import java.util.Map;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
 
-
 /**
  * Collection of convenience chunks for standard parts of the MSG file.
  * 
  * Not all of these will be present in any given file.
  * 
  * A partial list is available at:
- *  http://msdn.microsoft.com/en-us/library/ms526356%28v=exchg.10%29.aspx
- *  
+ * http://msdn.microsoft.com/en-us/library/ms526356%28v=exchg.10%29.aspx
+ * 
  * TODO Deprecate the public Chunks in favour of Property Lookups
  */
 public final class Chunks implements ChunkGroupWithProperties {
-   private static POILogger logger = POILogFactory.getLogger(Chunks.class);
+    private static POILogger logger = POILogFactory.getLogger(Chunks.class);
+
+    /**
+     * Holds all the chunks that were found, indexed by their MAPIProperty.
+     * Normally a property will have zero chunks (fixed sized) or one chunk
+     * (variable size), but in some cases (eg Unknown) you may get more.
+     */
+    private Map<MAPIProperty, List<Chunk>> allChunks = new HashMap<MAPIProperty, List<Chunk>>();
+
+    /** Type of message that the MSG represents (ie. IPM.Note) */
+    public StringChunk messageClass;
+    /** BODY Chunk, for plain/text messages */
+    public StringChunk textBodyChunk;
+    /** BODY Html Chunk, for html messages */
+    public StringChunk htmlBodyChunkString;
+    public ByteChunk htmlBodyChunkBinary;
+    /** BODY Rtf Chunk, for Rtf (Rich) messages */
+    public ByteChunk rtfBodyChunk;
+    /** Subject link chunk, in plain/text */
+    public StringChunk subjectChunk;
+    /**
+     * Value that is in the TO field (not actually the addresses as they are
+     * stored in recip directory nodes
+     */
+    public StringChunk displayToChunk;
+    /** Value that is in the FROM field */
+    public StringChunk displayFromChunk;
+    /** value that shows in the CC field */
+    public StringChunk displayCCChunk;
+    /** Value that shows in the BCC field */
+    public StringChunk displayBCCChunk;
+    /** Sort of like the subject line, but without the RE: and FWD: parts. */
+    public StringChunk conversationTopic;
+    /** Type of server that the message originated from (SMTP, etc). */
+    public StringChunk sentByServerType;
+    /** The email headers */
+    public StringChunk messageHeaders;
+    /** TODO */
+    public MessageSubmissionChunk submissionChunk;
+    /** TODO */
+    public StringChunk emailFromChunk;
+    /** The message ID */
+    public StringChunk messageId;
+    /** The message properties */
+    private MessagePropertiesChunk messageProperties;
+
+    public Map<MAPIProperty, List<PropertyValue>> getProperties() {
+        if (messageProperties != null) {
+            return messageProperties.getProperties();
+        } else
+            return Collections.emptyMap();
+    }
+
+    public Map<MAPIProperty, PropertyValue> getRawProperties() {
+        if (messageProperties != null) {
+            return messageProperties.getRawProperties();
+        } else
+            return Collections.emptyMap();
+    }
+
+    public Map<MAPIProperty, List<Chunk>> getAll() {
+        return allChunks;
+    }
+
+    public Chunk[] getChunks() {
+        ArrayList<Chunk> chunks = new ArrayList<Chunk>(allChunks.size());
+        for (List<Chunk> c : allChunks.values()) {
+            chunks.addAll(c);
+        }
+        return chunks.toArray(new Chunk[chunks.size()]);
+    }
+
+    /**
+     * Called by the parser whenever a chunk is found.
+     */
+    public void record(Chunk chunk) {
+        // Work out what MAPIProperty this corresponds to
+        MAPIProperty prop = MAPIProperty.get(chunk.getChunkId());
+
+        // Assign it for easy lookup, as best we can
+        if (prop == MAPIProperty.MESSAGE_CLASS) {
+            messageClass = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.INTERNET_MESSAGE_ID) {
+            messageId = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.MESSAGE_SUBMISSION_ID) {
+            // TODO - parse
+            submissionChunk = (MessageSubmissionChunk) chunk;
+        } else if (prop == MAPIProperty.RECEIVED_BY_ADDRTYPE) {
+            sentByServerType = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.TRANSPORT_MESSAGE_HEADERS) {
+            messageHeaders = (StringChunk) chunk;
+        }
+
+        else if (prop == MAPIProperty.CONVERSATION_TOPIC) {
+            conversationTopic = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.SUBJECT) {
+            subjectChunk = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.ORIGINAL_SUBJECT) {
+            // TODO
+        }
+
+        else if (prop == MAPIProperty.DISPLAY_TO) {
+            displayToChunk = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.DISPLAY_CC) {
+            displayCCChunk = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.DISPLAY_BCC) {
+            displayBCCChunk = (StringChunk) chunk;
+        }
+
+        else if (prop == MAPIProperty.SENDER_EMAIL_ADDRESS) {
+            emailFromChunk = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.SENDER_NAME) {
+            displayFromChunk = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.BODY) {
+            textBodyChunk = (StringChunk) chunk;
+        } else if (prop == MAPIProperty.BODY_HTML) {
+            if (chunk instanceof StringChunk) {
+                htmlBodyChunkString = (StringChunk) chunk;
+            }
+            if (chunk instanceof ByteChunk) {
+                htmlBodyChunkBinary = (ByteChunk) chunk;
+            }
+        } else if (prop == MAPIProperty.RTF_COMPRESSED) {
+            rtfBodyChunk = (ByteChunk) chunk;
+        } else if (chunk instanceof MessagePropertiesChunk) {
+            messageProperties = (MessagePropertiesChunk) chunk;
+        }
+
+        // And add to the main list
+        if (allChunks.get(prop) == null) {
+            allChunks.put(prop, new ArrayList<Chunk>());
+        }
+        allChunks.get(prop).add(chunk);
+    }
 
-   /** 
-    * Holds all the chunks that were found, indexed by their MAPIProperty.
-    * Normally a property will have zero chunks (fixed sized) or one chunk 
-    *  (variable size), but in some cases (eg Unknown) you may get more.
-    */
-   private Map<MAPIProperty,List<Chunk>> allChunks = new HashMap<MAPIProperty,List<Chunk>>();
-   
-   /** Type of message that the MSG represents (ie. IPM.Note) */
-   public StringChunk messageClass;
-   /** BODY Chunk, for plain/text messages */
-   public StringChunk textBodyChunk;
-   /** BODY Html Chunk, for html messages */
-   public StringChunk htmlBodyChunkString;
-   public ByteChunk htmlBodyChunkBinary;
-   /** BODY Rtf Chunk, for Rtf (Rich) messages */
-   public ByteChunk rtfBodyChunk;
-   /** Subject link chunk, in plain/text */
-   public StringChunk subjectChunk;
-   /** 
-    * Value that is in the TO field (not actually the addresses as they are 
-    * stored in recip directory nodes 
-    */
-   public StringChunk displayToChunk;
-   /** Value that is in the FROM field */
-   public StringChunk displayFromChunk;
-   /** value that shows in the CC field */
-   public StringChunk displayCCChunk;
-   /** Value that shows in the BCC field */
-   public StringChunk displayBCCChunk;
-   /** Sort of like the subject line, but without the RE: and FWD: parts. */
-   public StringChunk conversationTopic;
-   /** Type of server that the message originated from (SMTP, etc). */
-   public StringChunk sentByServerType;
-   /** The email headers */
-   public StringChunk messageHeaders;
-   /** TODO */
-   public MessageSubmissionChunk submissionChunk; 
-   /** TODO */
-   public StringChunk emailFromChunk; 
-   /** The message ID */
-   public StringChunk messageId;
-   /** The message properties */
-   private MessagePropertiesChunk messageProperties;
-
-   public Map<MAPIProperty,List<PropertyValue>> getProperties() {
-      if (messageProperties != null) {
-         return messageProperties.getProperties();
-      }
-      else return Collections.emptyMap();
-   }
-   public Map<MAPIProperty, PropertyValue> getRawProperties() {
-      if (messageProperties != null) {
-         return messageProperties.getRawProperties();
-      }
-      else return Collections.emptyMap();
-   }
-   
-   public Map<MAPIProperty,List<Chunk>> getAll() {
-      return allChunks;
-   }
-   public Chunk[] getChunks() {
-      ArrayList<Chunk> chunks = new ArrayList<Chunk>(allChunks.size());
-      for (List<Chunk> c : allChunks.values()) {
-         chunks.addAll(c);
-      }
-      return chunks.toArray(new Chunk[chunks.size()]);
-   }
-	
-   /**
-    * Called by the parser whenever a chunk is found.
-    */
-   public void record(Chunk chunk) {
-      // Work out what MAPIProperty this corresponds to
-      MAPIProperty prop = MAPIProperty.get(chunk.getChunkId());
-      
-      // Assign it for easy lookup, as best we can
-      if(prop == MAPIProperty.MESSAGE_CLASS) {
-         messageClass = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.INTERNET_MESSAGE_ID) {
-         messageId = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.MESSAGE_SUBMISSION_ID) {
-         // TODO - parse
-         submissionChunk = (MessageSubmissionChunk)chunk;
-      }
-      else if(prop == MAPIProperty.RECEIVED_BY_ADDRTYPE) {
-         sentByServerType = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.TRANSPORT_MESSAGE_HEADERS) {
-         messageHeaders = (StringChunk)chunk;
-      }
-      
-      else if(prop == MAPIProperty.CONVERSATION_TOPIC) {
-         conversationTopic = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.SUBJECT) {
-         subjectChunk = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.ORIGINAL_SUBJECT) {
-         // TODO
-      }
-      
-      else if(prop == MAPIProperty.DISPLAY_TO) {
-         displayToChunk = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.DISPLAY_CC) {
-         displayCCChunk = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.DISPLAY_BCC) {
-         displayBCCChunk = (StringChunk)chunk;
-      }
-      
-      else if(prop == MAPIProperty.SENDER_EMAIL_ADDRESS) {
-         emailFromChunk = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.SENDER_NAME) {
-         displayFromChunk = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.BODY) {
-         textBodyChunk = (StringChunk)chunk;
-      }
-      else if(prop == MAPIProperty.BODY_HTML) {
-         if(chunk instanceof StringChunk) {
-            htmlBodyChunkString = (StringChunk)chunk;
-         }
-         if(chunk instanceof ByteChunk) {
-            htmlBodyChunkBinary = (ByteChunk)chunk;
-         }
-      }
-      else if(prop == MAPIProperty.RTF_COMPRESSED) {
-         rtfBodyChunk = (ByteChunk)chunk;
-      }
-      else if(chunk instanceof MessagePropertiesChunk) {
-         messageProperties = (MessagePropertiesChunk) chunk;
-      }
-      
-      // And add to the main list
-      if (allChunks.get(prop) == null) {
-         allChunks.put(prop, new ArrayList<Chunk>());
-      }
-      allChunks.get(prop).add(chunk);
-   }
-   
-   public void chunksComplete() {
-      if (messageProperties != null) {
-         messageProperties.matchVariableSizedPropertiesToChunks();
-      } else {
-         logger.log(POILogger.WARN, "Message didn't contain a root list of properties!");
-      }
-   }
+    public void chunksComplete() {
+        if (messageProperties != null) {
+            messageProperties.matchVariableSizedPropertiesToChunks();
+        } else {
+            logger.log(POILogger.WARN,
+                    "Message didn't contain a root list of properties!");
+        }
+    }
 }
\ No newline at end of file

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java?rev=1773544&r1=1773543&r2=1773544&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/DirectoryChunk.java Sat Dec 10 23:35:12 2016
@@ -25,33 +25,28 @@ import org.apache.poi.hsmf.datatypes.Typ
 import org.apache.poi.poifs.filesystem.DirectoryNode;
 
 /**
- * A Chunk that is just a placeholder in the
- *  MAPIMessage directory structure, which
- *  contains children.
- * This is most commonly used with nested
- *  MAPIMessages
+ * A Chunk that is just a placeholder in the MAPIMessage directory structure,
+ * which contains children. This is most commonly used with nested MAPIMessages
  */
 public class DirectoryChunk extends Chunk {
     private DirectoryNode dir;
-    
+
     public DirectoryChunk(DirectoryNode dir, String namePrefix, int chunkId, MAPIType type) {
         super(namePrefix, chunkId, type);
         this.dir = dir;
     }
-    
+
     /**
-     * Returns the directory entry for this chunk.
-     * You can then use standard POIFS methods to
-     *  enumerate the entries in it.
+     * Returns the directory entry for this chunk. You can then use standard
+     * POIFS methods to enumerate the entries in it.
      */
     public DirectoryNode getDirectory() {
         return dir;
     }
-    
+
     /**
-     * Treats the directory as an embeded MAPIMessage
-     *  (it normally is one), and returns a MAPIMessage
-     *  object to process it with.
+     * Treats the directory as an embeded MAPIMessage (it normally is one), and
+     * returns a MAPIMessage object to process it with.
      */
     public MAPIMessage getAsEmbededMessage() throws IOException {
         return new MAPIMessage(dir);




---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org