You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2013/06/26 17:23:30 UTC
svn commit: r1496962 - in /poi/trunk/src/scratchpad/src/org/apache/poi/hsmf:
./ datatypes/
Author: nick
Date: Wed Jun 26 15:23:29 2013
New Revision: 1496962
URL: http://svn.apache.org/r1496962
Log:
Fix inconsistent whitespace in HSMF files
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.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/ChunkGroup.java
poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessageSubmissionChunk.java
poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java
poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java?rev=1496962&r1=1496961&r2=1496962&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java Wed Jun 26 15:23:29 2013
@@ -92,7 +92,7 @@ public class MAPIMessage extends POIDocu
* @throws IOException
*/
public MAPIMessage(InputStream in) throws IOException {
- this(new POIFSFileSystem(in));
+ this(new NPOIFSFileSystem(in));
}
/**
* Constructor for reading MSG Files from a POIFS filesystem
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=1496962&r1=1496961&r2=1496962&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 Wed Jun 26 15:23:29 2013
@@ -24,29 +24,28 @@ import org.apache.poi.hsmf.datatypes.Typ
import org.apache.poi.util.IOUtils;
/**
- * A Chunk that holds binary data, normally
- * unparsed.
+ * 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;
-
- /**
- * Creates a Byte Chunk.
- */
+ 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);
- }
+ /**
+ * 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);
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=1496962&r1=1496961&r2=1496962&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 Wed Jun 26 15:23:29 2013
@@ -23,55 +23,55 @@ import java.io.OutputStream;
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
-abstract public class Chunk {
+public abstract class Chunk {
public static final String DEFAULT_NAME_PREFIX = "__substg1.0_";
- protected int chunkId;
- protected MAPIType type;
- protected String namePrefix;
+ 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() + type.toUpperCase();
- }
-
- /**
- * 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;
+ 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() + type.toUpperCase();
+ }
+
+ /**
+ * 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/ChunkGroup.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/ChunkGroup.java?rev=1496962&r1=1496961&r2=1496962&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 Wed Jun 26 15:23:29 2013
@@ -27,15 +27,15 @@ public interface ChunkGroup {
* Should certainly contain all the interesting Chunks,
* but needn't always contain all of the Chunks.
*/
- public Chunk[] getChunks();
-
- /**
- * Called by the parser whenever a chunk is found.
- */
- public void record(Chunk chunk);
-
- /**
- * Called by the parser when all chunks have been found.
- */
- public void chunksComplete();
+ public Chunk[] getChunks();
+
+ /**
+ * Called by the parser whenever a chunk is found.
+ */
+ public void record(Chunk chunk);
+
+ /**
+ * Called by the parser when all chunks have been found.
+ */
+ public void chunksComplete();
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessageSubmissionChunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessageSubmissionChunk.java?rev=1496962&r1=1496961&r2=1496962&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessageSubmissionChunk.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/MessageSubmissionChunk.java Wed Jun 26 15:23:29 2013
@@ -36,29 +36,28 @@ import org.apache.poi.util.POILogger;
* server, and an ID that's used if you want to cancel
* a message or similar
*/
-
public class MessageSubmissionChunk extends Chunk {
- private static POILogger logger = POILogFactory.getLogger(MessageSubmissionChunk.class);
- private String rawId;
- private Calendar date;
-
- private static final Pattern datePatern =
- Pattern.compile("(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)Z?");
-
- /**
- * Creates a Byte Chunk.
- */
- public MessageSubmissionChunk(String namePrefix, int chunkId, MAPIType type) {
- super(namePrefix, chunkId, type);
- }
-
- /**
- * Create a Byte Chunk, with the specified
- * type.
- */
- public MessageSubmissionChunk(int chunkId, MAPIType type) {
- super(chunkId, type);
- }
+ private static POILogger logger = POILogFactory.getLogger(MessageSubmissionChunk.class);
+ private String rawId;
+ private Calendar date;
+
+ private static final Pattern datePatern =
+ Pattern.compile("(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)Z?");
+
+ /**
+ * Creates a Byte Chunk.
+ */
+ public MessageSubmissionChunk(String namePrefix, int chunkId, MAPIType type) {
+ super(namePrefix, chunkId, type);
+ }
+
+ /**
+ * Create a Byte Chunk, with the specified
+ * type.
+ */
+ public MessageSubmissionChunk(int chunkId, MAPIType type) {
+ super(chunkId, type);
+ }
public void readValue(InputStream value) throws IOException {
// Stored in the file as us-ascii
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java?rev=1496962&r1=1496961&r2=1496962&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/PropertiesChunk.java Wed Jun 26 15:23:29 2013
@@ -28,7 +28,6 @@ import java.util.Map;
import org.apache.poi.hsmf.datatypes.PropertyValue.LongLongPropertyValue;
import org.apache.poi.hsmf.datatypes.PropertyValue.TimePropertyValue;
import org.apache.poi.hsmf.datatypes.Types.MAPIType;
-import org.apache.poi.util.HexDump;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.LittleEndian.BufferUnderrunException;
@@ -60,17 +59,17 @@ public abstract class PropertiesChunk ex
*/
private ChunkGroup parentGroup;
- /**
- * Creates a Properties Chunk.
- */
- protected PropertiesChunk(ChunkGroup parentGroup) {
- super(NAME, -1, Types.UNKNOWN);
- this.parentGroup = parentGroup;
- }
+ /**
+ * Creates a Properties Chunk.
+ */
+ protected PropertiesChunk(ChunkGroup parentGroup) {
+ super(NAME, -1, Types.UNKNOWN);
+ this.parentGroup = parentGroup;
+ }
- @Override
+ @Override
public String getEntryName() {
- return NAME;
+ return NAME;
}
/**
@@ -198,9 +197,9 @@ public abstract class PropertiesChunk ex
going = false;
}
}
- }
-
- protected void writeProperties(OutputStream out) throws IOException {
- // TODO
- }
+ }
+
+ protected void writeProperties(OutputStream out) throws IOException {
+ // TODO
+ }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java?rev=1496962&r1=1496961&r2=1496962&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hsmf/datatypes/StringChunk.java Wed Jun 26 15:23:29 2013
@@ -35,68 +35,68 @@ public class StringChunk extends Chunk {
private byte[] rawValue;
private String value;
- /**
- * Creates a String Chunk.
- */
- public StringChunk(String namePrefix, int chunkId, MAPIType type) {
- super(namePrefix, chunkId, type);
- }
-
- /**
- * Create a String Chunk, with the specified
- * type.
- */
- public StringChunk(int chunkId, MAPIType type) {
- super(chunkId, type);
- }
-
- /**
- * Returns the Encoding that will be used to
- * decode any "7 bit" (non unicode) data.
- * Most files default to CP1252
- */
- public String get7BitEncoding() {
- return encoding7Bit;
- }
-
- /**
- * Sets the Encoding that will be used to
- * decode any "7 bit" (non unicode) data.
- * This doesn't appear to be stored anywhere
- * specific in the file, so you may need
- * to guess by looking at headers etc
- */
- public void set7BitEncoding(String encoding) {
- this.encoding7Bit = encoding;
-
- // Re-read the String if we're a 7 bit one
- if(type == Types.ASCII_STRING) {
- parseString();
- }
- }
-
- public void readValue(InputStream value) throws IOException {
- rawValue = IOUtils.toByteArray(value);
- parseString();
- }
- private void parseString() {
- String tmpValue;
- if (type == Types.ASCII_STRING) {
- tmpValue = parseAs7BitData(rawValue, encoding7Bit);
- } else if (type == Types.UNICODE_STRING) {
- tmpValue = StringUtil.getFromUnicodeLE(rawValue);
- } else {
- throw new IllegalArgumentException("Invalid type " + type + " for String Chunk");
- }
-
- // Clean up
- this.value = tmpValue.replace("\0", "");
- }
-
- public void writeValue(OutputStream out) throws IOException {
- out.write(rawValue);
- }
- private void storeString() {
+ /**
+ * Creates a String Chunk.
+ */
+ public StringChunk(String namePrefix, int chunkId, MAPIType type) {
+ super(namePrefix, chunkId, type);
+ }
+
+ /**
+ * Create a String Chunk, with the specified
+ * type.
+ */
+ public StringChunk(int chunkId, MAPIType type) {
+ super(chunkId, type);
+ }
+
+ /**
+ * Returns the Encoding that will be used to
+ * decode any "7 bit" (non unicode) data.
+ * Most files default to CP1252
+ */
+ public String get7BitEncoding() {
+ return encoding7Bit;
+ }
+
+ /**
+ * Sets the Encoding that will be used to
+ * decode any "7 bit" (non unicode) data.
+ * This doesn't appear to be stored anywhere
+ * specific in the file, so you may need
+ * to guess by looking at headers etc
+ */
+ public void set7BitEncoding(String encoding) {
+ this.encoding7Bit = encoding;
+
+ // Re-read the String if we're a 7 bit one
+ if(type == Types.ASCII_STRING) {
+ parseString();
+ }
+ }
+
+ public void readValue(InputStream value) throws IOException {
+ rawValue = IOUtils.toByteArray(value);
+ parseString();
+ }
+ private void parseString() {
+ String tmpValue;
+ if (type == Types.ASCII_STRING) {
+ tmpValue = parseAs7BitData(rawValue, encoding7Bit);
+ } else if (type == Types.UNICODE_STRING) {
+ tmpValue = StringUtil.getFromUnicodeLE(rawValue);
+ } else {
+ throw new IllegalArgumentException("Invalid type " + type + " for String Chunk");
+ }
+
+ // Clean up
+ this.value = tmpValue.replace("\0", "");
+ }
+
+ public void writeValue(OutputStream out) throws IOException {
+ out.write(rawValue);
+ }
+ private void storeString() {
if (type == Types.ASCII_STRING) {
try {
rawValue = value.getBytes(encoding7Bit);
@@ -109,15 +109,15 @@ public class StringChunk extends Chunk {
} else {
throw new IllegalArgumentException("Invalid type " + type + " for String Chunk");
}
- }
-
- /**
- * Returns the Text value of the chunk
- */
+ }
+
+ /**
+ * Returns the Text value of the chunk
+ */
public String getValue() {
return this.value;
}
-
+
public byte[] getRawValue() {
return this.rawValue;
}
@@ -126,7 +126,7 @@ public class StringChunk extends Chunk {
this.value = str;
storeString();
}
-
+
public String toString() {
return this.value;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org