You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by kl...@apache.org on 2003/09/13 14:31:28 UTC
cvs commit: jakarta-poi/src/java/org/apache/poi/hpsf ClassID.java MutableSection.java PropertySetFactory.java Section.java SummaryInformation.java package.html
klute 2003/09/13 05:31:28
Modified: src/java/org/apache/poi/hpsf ClassID.java
MutableSection.java PropertySetFactory.java
Section.java SummaryInformation.java package.html
Log:
- PropertySetFactory.create(InputStream) no longer throws an UnexpectedPropertySetTypeException.
- HPSFRuntimeException is thrown when the application tries to read a non-integer property with Section.getPropertyIntValue(long).
- Package description updated.
- ClassIDhashCode() implemented.
Revision Changes Path
1.9 +2 -2 jakarta-poi/src/java/org/apache/poi/hpsf/ClassID.java
Index: ClassID.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/ClassID.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ClassID.java 30 Aug 2003 09:13:52 -0000 1.8
+++ ClassID.java 13 Sep 2003 12:31:28 -0000 1.9
@@ -236,7 +236,7 @@
*/
public int hashCode()
{
- throw new UnsupportedOperationException("FIXME: Not yet implemented.");
+ return new String(bytes).hashCode();
}
}
1.3 +1 -2 jakarta-poi/src/java/org/apache/poi/hpsf/MutableSection.java
Index: MutableSection.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/MutableSection.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MutableSection.java 4 Sep 2003 20:15:24 -0000 1.2
+++ MutableSection.java 13 Sep 2003 12:31:28 -0000 1.3
@@ -62,7 +62,6 @@
import java.util.List;
import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.LittleEndianConsts;
/**
* <p>Adds writing capability to the {@link Section} class.</p>
1.9 +18 -8 jakarta-poi/src/java/org/apache/poi/hpsf/PropertySetFactory.java
Index: PropertySetFactory.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/PropertySetFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PropertySetFactory.java 30 Aug 2003 09:13:52 -0000 1.8
+++ PropertySetFactory.java 13 Sep 2003 12:31:28 -0000 1.9
@@ -56,6 +56,7 @@
import java.io.InputStream;
import java.io.IOException;
+import java.rmi.UnexpectedException;
/**
* <p>Factory class to create instances of {@link SummaryInformation},
@@ -89,15 +90,24 @@
*/
public static PropertySet create(final InputStream stream)
throws NoPropertySetStreamException, MarkUnsupportedException,
- UnexpectedPropertySetTypeException, IOException
+ IOException
{
final PropertySet ps = new PropertySet(stream);
- if (ps.isSummaryInformation())
- return new SummaryInformation(ps);
- else if (ps.isDocumentSummaryInformation())
- return new DocumentSummaryInformation(ps);
- else
- return ps;
+ try
+ {
+ if (ps.isSummaryInformation())
+ return new SummaryInformation(ps);
+ else if (ps.isDocumentSummaryInformation())
+ return new DocumentSummaryInformation(ps);
+ else
+ return ps;
+ }
+ catch (UnexpectedPropertySetTypeException ex)
+ {
+ /* This exception will never be throws because we already checked
+ * explicitly for this case above. */
+ throw new UnexpectedException(ex.toString());
+ }
}
}
1.17 +10 -5 jakarta-poi/src/java/org/apache/poi/hpsf/Section.java
Index: Section.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/Section.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Section.java 4 Sep 2003 20:15:24 -0000 1.16
+++ Section.java 13 Sep 2003 12:31:28 -0000 1.17
@@ -401,11 +401,16 @@
*/
protected int getPropertyIntValue(final long id)
{
- final Long i = (Long) getProperty(id);
- if (i != null)
- return i.intValue();
- else
+ final Long i;
+ final Object o = getProperty(id);
+ if (o == null)
return 0;
+ if (!(o instanceof Long))
+ throw new HPSFRuntimeException
+ ("This property is not an integer type, but " +
+ o.getClass().getName() + ".");
+ i = (Long) o;
+ return i.intValue();
}
1.13 +13 -6 jakarta-poi/src/java/org/apache/poi/hpsf/SummaryInformation.java
Index: SummaryInformation.java
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/SummaryInformation.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SummaryInformation.java 30 Aug 2003 09:13:52 -0000 1.12
+++ SummaryInformation.java 13 Sep 2003 12:31:28 -0000 1.13
@@ -204,13 +204,19 @@
/**
- * <p>Returns the stream's edit time (or <code>null</code>).</p>
+ * <p>Returns the total time spent in editing the document
+ * (or <code>0</code>).</p>
*
- * @return The edit time or <code>null</code>
+ * @return The total time spent in editing the document or 0 if the {@link
+ * SummaryInformation} does not contain this information.
*/
- public Date getEditTime()
+ public long getEditTime()
{
- return (Date) getProperty(PropertyIDMap.PID_EDITTIME);
+ final Date d = (Date) getProperty(PropertyIDMap.PID_EDITTIME);
+ if (d == null)
+ return 0;
+ else
+ return Util.dateToFileTime(d);
}
@@ -258,7 +264,8 @@
* <p>Returns the stream's page count or 0 if the {@link
* SummaryInformation} does not contain a page count.</p>
*
- * @return The page count or <code>null</code>
+ * @return The page count or 0 if the {@link SummaryInformation} does not
+ * contain a page count.
*/
public int getPageCount()
{
1.5 +27 -14 jakarta-poi/src/java/org/apache/poi/hpsf/package.html
Index: package.html
===================================================================
RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/package.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- package.html 1 Sep 2003 18:52:55 -0000 1.4
+++ package.html 13 Sep 2003 12:31:28 -0000 1.5
@@ -9,7 +9,7 @@
<div>
<p>Processes streams in the Horrible Property Set Format (HPSF) in POI
filesystems. Microsoft Office documents, i.e. POI filesystems, usually
- contain meta data like author, title, last editing date etc. These items
+ contain meta data like author, title, last saving time etc. These items
are called <strong>properties</strong> and stored in
<strong>property set streams</strong> along with the document itself. These
streams are commonly named <tt>\005SummaryInformation</tt> and
@@ -71,31 +71,44 @@
the hassle of first finding out what the title's property ID is and then
using this ID to get the property's value.</p>
+ <p>Writing properties can be done with the classes
+ {@link org.apache.poi.hpsf.MutablePropertySet}, {@link
+ org.apache.poi.hpsf.MutableSection}, and {@link
+ org.apache.poi.hpsf.MutableProperty}.</p>
+
<div>
- <h2>To Do</h2>
+ <h2>History</h2>
- <p>The following is still left to be implemented:</p>
+ <dl>
+ <dt>2003-09-11:</dt>
- <ul>
+ <dd>
+ <p>{@link org.apache.poi.hpsf.PropertySetFactory#create(InputStream)} no
+ longer throws an
+ {@link org.apache.poi.hpsf.UnexpectedPropertySetTypeException}.</p></dd>
+ </dl>
+ </div>
- <li>
- <p>Property dictionaries</p>
- </li>
- <li>
- <p>Writing property sets</p>
- </li>
+ <div>
+ <h2>To Do</h2>
+
+ <p>The following is still left to be implemented. Sponsering could foster
+ these issues considerably.</p>
+
+ <ul>
<li>
- <p>Codepage support</p>
+ <p>Convenience methods for setting summary information and document
+ summary information properties</p>
</li>
<li>
- <p>Property type Unicode string</p>
+ <p>Better codepage support</p>
</li>
<li>
- <p>Further property types</p>
+ <p>Support for more property (variant) types</p>
</li>
</ul>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org