poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject cvs commit: jakarta-poi/src/java/org/apache/poi/hpsf ClassID.java DocumentSummaryInformation.java PropertySet.java Section.java SpecialPropertySet.java SummaryInformation.java
Date Sat, 22 Feb 2003 14:27:16 GMT
klute       2003/02/22 06:27:16

  Modified:    src/java/org/apache/poi/hpsf ClassID.java
                        DocumentSummaryInformation.java PropertySet.java
                        Section.java SpecialPropertySet.java
                        SummaryInformation.java
  Log:
  First preparations for HPSF writing functionality.
  
  Revision  Changes    Path
  1.5       +51 -3     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClassID.java	17 Jul 2002 16:23:22 -0000	1.4
  +++ ClassID.java	22 Feb 2003 14:27:15 -0000	1.5
  @@ -92,6 +92,18 @@
       }
   
   
  +    /**
  +     *  <p>Creates a {@link ClassID} and initializes its value with
  +     *  0x00 bytes.</p>
  +     */
  +    public ClassID()
  +    {
  +	bytes = new byte[LENGTH];
  +	for (int i = 0; i < LENGTH; i++)
  +	    bytes[i] = 0x00;
  +    }
  +
  +
   
       public final static int LENGTH = 16;
   
  @@ -114,8 +126,8 @@
   
   
       /**
  -     * <p>Reads a class ID from a byte array by turning little-endian
  -     * into big-endian.</p>
  +     * <p>Reads the class ID's value from a byte array by turning
  +     * little-endian into big-endian.</p>
        *
        * @param src The byte array to read from
        *
  @@ -146,6 +158,42 @@
   	    bytes[i] = src[i + offset];
   
           return bytes;
  +    }
  +
  +
  +
  +    /**
  +     * <p>Writes the class ID to a byte array in the
  +     * little-endian.</p>
  +     *
  +     * @param dst The byte array to write to.
  +     *
  +     * @param offset The offset within the <var>dst</var> byte array.
  +     *
  +     * @throws ArrayIndexOutOfBoundsException if there is not enough
  +     * room for the class ID in the byte array. There must be at least
  +     * 16 bytes in the byte array after the <var>offset</var>
  +     * position.
  +     */
  +    public void write(final byte[] dst, final int offset)
  +    {
  +        /* Write double word. */
  +	dst[0 + offset] = bytes[3];
  +	dst[1 + offset] = bytes[2];
  +	dst[2 + offset] = bytes[1];
  +	dst[3 + offset] = bytes[0];
  +
  +        /* Write first word. */
  +	dst[4 + offset] = bytes[5];
  +	dst[5 + offset] = bytes[4];
  +
  +        /* Write second word. */
  +	dst[6 + offset] = bytes[7];
  +	dst[7 + offset] = bytes[6];
  +
  +	/* Write 8 bytes. */
  +	for (int i = 8; i < 16; i++)
  +	    dst[i + offset] = bytes[i];
       }
   
   }
  
  
  
  1.9       +10 -1     jakarta-poi/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java
  
  Index: DocumentSummaryInformation.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DocumentSummaryInformation.java	10 Dec 2002 06:15:19 -0000	1.8
  +++ DocumentSummaryInformation.java	22 Feb 2003 14:27:15 -0000	1.9
  @@ -72,6 +72,15 @@
   {
   
       /**
  +     * <p>The document name a document summary information stream
  +     * usually has in a POIFS filesystem.</p>
  +     */
  +    public static final String DEFAULT_STREAM_NAME =
  +        "\005DocumentSummaryInformation";
  +
  +
  +
  +    /**
        * <p>Creates a {@link DocumentSummaryInformation} from a given
        * {@link PropertySet}.</p>
        *
  
  
  
  1.9       +31 -15    jakarta-poi/src/java/org/apache/poi/hpsf/PropertySet.java
  
  Index: PropertySet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/PropertySet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PropertySet.java	30 Jul 2002 14:56:02 -0000	1.8
  +++ PropertySet.java	22 Feb 2003 14:27:16 -0000	1.9
  @@ -103,16 +103,10 @@
   	new byte[]{(byte) 0xFE, (byte) 0xFF};
   
       /**
  -     * <p>The "format" field must equal this value.</p>
  -     */
  -    final static byte[] FORMAT_ASSERTION =
  -	new byte[]{(byte) 0x00, (byte) 0x00};
  -
  -    /**
        * <p>Specifies this {@link PropertySet}'s byte order. See the
        * HPFS documentation for details!</p>
        */
  -    private int byteOrder;
  +    protected int byteOrder;
   
       /**
        * <p>Returns the property set stream's low-level "byte order"
  @@ -128,10 +122,16 @@
   
   
       /**
  +     * <p>The "format" field must equal this value.</p>
  +     */
  +    final static byte[] FORMAT_ASSERTION =
  +	new byte[]{(byte) 0x00, (byte) 0x00};
  +
  +    /**
        * <p>Specifies this {@link PropertySet}'s format. See the HPFS
        * documentation for details!</p>
        */
  -    private int format;
  +    protected int format;
   
       /**
        * <p>Returns the property set stream's low-level "format"
  @@ -151,12 +151,21 @@
        * this {@link PropertySet}. See the HPFS documentation for
        * details!</p>
        */
  -    private long osVersion;
  +    protected int osVersion;
  +
  +
  +    public final static int OS_WIN16     = 0x0000;
  +    public final static int OS_MACINTOSH = 0x0001;
  +    public final static int OS_WIN32     = 0x0002;
   
       /**
        * <p>Returns the property set stream's low-level "OS version"
        * field.</p>
        *
  +     * <p><strong>FIXME:</strong> Return an <code>int</code>
instead
  +     * of a <code>long</code> in the next major version, i.e. when
  +     * incompatible changes are allowed.</p>
  +     *
        * @return The property set stream's low-level "OS version" field.
        */
       public long getOSVersion()
  @@ -170,7 +179,7 @@
        * <p>Specifies this {@link PropertySet}'s "classID" field. See
        * the HPFS documentation for details!</p>
        */
  -    private ClassID classID;
  +    protected ClassID classID;
   
       /**
        * <p>Returns the property set stream's low-level "class ID"
  @@ -188,13 +197,17 @@
       /**
        * <p>The number of sections in this {@link PropertySet}.</p>
        */
  -    private long sectionCount;
  +    protected int sectionCount;
   
   
       /**
        * <p>Returns the number of {@link Section}s in the property
        * set.</p>
        *
  +     * <p><strong>FIXME:</strong> Return an <code>int</code>
instead
  +     * of a <code>long</code> in the next major version, i.e. when
  +     * incompatible changes are allowed.</p>
  +     *
        * @return The number of {@link Section}s in the property set.
        */
       public long getSectionCount()
  @@ -207,7 +220,7 @@
       /**
        * <p>The sections in this {@link PropertySet}.</p>
        */
  -    private List sections;
  +    protected List sections;
   
   
       /**
  @@ -420,12 +433,15 @@
           offset += LittleEndian.SHORT_SIZE;
           format = LittleEndian.getUShort(src, offset);
           offset += LittleEndian.SHORT_SIZE;
  -        osVersion = LittleEndian.getUInt(src, offset);
  +        osVersion = (int) LittleEndian.getUInt(src, offset);
           offset += LittleEndian.INT_SIZE;
           classID = new ClassID(src, offset);
           offset += ClassID.LENGTH;
  -        sectionCount = LittleEndian.getUInt(src, offset);
  +        sectionCount = LittleEndian.getInt(src, offset);
           offset += LittleEndian.INT_SIZE;
  +	if (sectionCount <= 0)
  +	    throw new HPSFRuntimeException("Section count " + sectionCount +
  +					   " must be greater than 0.");
   
           /*
            * Read the sections, which are following the header. They
  
  
  
  1.10      +14 -6     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Section.java	29 Jan 2003 18:01:18 -0000	1.9
  +++ Section.java	22 Feb 2003 14:27:16 -0000	1.10
  @@ -75,7 +75,7 @@
        */
       protected Map dictionary;
   
  -    private ClassID formatID;
  +    protected ClassID formatID;
   
   
       /**
  @@ -95,7 +95,7 @@
   
   
   
  -    private long offset;
  +    protected long offset;
   
   
       /**
  @@ -110,7 +110,7 @@
   
   
   
  -    private int size;
  +    protected int size;
   
   
       /**
  @@ -125,7 +125,7 @@
   
   
   
  -    private int propertyCount;
  +    protected int propertyCount;
   
   
       /**
  @@ -140,7 +140,7 @@
   
   
   
  -    private Property[] properties;
  +    protected Property[] properties;
   
   
       /**
  @@ -152,6 +152,14 @@
       {
           return properties;
       }
  +
  +
  +
  +    /**
  +     * <p>Creates an empty and uninitialized {@link Section}.
  +     */
  +    protected Section()
  +    {}
   
   
   
  
  
  
  1.8       +15 -1     jakarta-poi/src/java/org/apache/poi/hpsf/SpecialPropertySet.java
  
  Index: SpecialPropertySet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-poi/src/java/org/apache/poi/hpsf/SpecialPropertySet.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SpecialPropertySet.java	1 Feb 2003 13:28:28 -0000	1.7
  +++ SpecialPropertySet.java	22 Feb 2003 14:27:16 -0000	1.8
  @@ -115,6 +115,13 @@
   
   
   
  +    /*
  +     * This is intentionally no javadoc comment.
  +     *
  +     * FIXME: Return an <code>int</code> instead of a
  +     * <code>long</code> in the next major version, i.e. when
  +     * incompatible changes are allowed.
  +     */
       public long getOSVersion()
       {
           return delegate.getOSVersion();
  @@ -129,6 +136,13 @@
   
   
   
  +    /*
  +     * This is intentionally no javadoc comment.
  +     *
  +     * FIXME: Return an <code>int</code> instead of a
  +     * <code>long</code> in the next major version, i.e. when
  +     * incompatible changes are allowed.
  +     */
       public long getSectionCount()
       {
           return delegate.getSectionCount();
  
  
  
  1.10      +9 -1      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SummaryInformation.java	1 Feb 2003 13:28:28 -0000	1.9
  +++ SummaryInformation.java	22 Feb 2003 14:27:16 -0000	1.10
  @@ -79,6 +79,14 @@
   {
   
       /**
  +     * <p>The document name a summary information stream usually has
  +     * in a POIFS filesystem.</p>
  +     */
  +    public static final String DEFAULT_STREAM_NAME = "\005SummaryInformation";
  +
  +
  +
  +    /**
        * <p>Creates a {@link SummaryInformation} from a given {@link
        * PropertySet}.</p>
        *
  
  
  

Mime
View raw message