]> source.dussan.org Git - poi.git/commitdiff
fix default values for byte[] fields in autogenerated files
authorSergey Vladimirov <sergey@apache.org>
Wed, 21 Sep 2011 15:33:29 +0000 (15:33 +0000)
committerSergey Vladimirov <sergey@apache.org>
Wed, 21 Sep 2011 15:33:29 +0000 (15:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173719 13f79535-47bb-0310-9956-ffa450edef68

src/types/styles/hdftype.xsl

index ba8297e892197c561507bc024e72b5e243f6e64f..303433302c0231b537659a6d600d6c012e78348a 100644 (file)
@@ -90,6 +90,16 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
             <xsl:when test="@type='int'"/>
             <xsl:when test="@type='short'"/>
             <xsl:when test="@type='long'"/>
+            <xsl:when test="@type='byte[]'">
+                <xsl:call-template name="indent"/>
+                <xsl:call-template name="indent"/>
+                <xsl:text>this.</xsl:text>
+                <xsl:value-of select="recutil:getFieldName(position(),@name,0)"/>
+                <xsl:text> = new byte[</xsl:text>
+                <xsl:value-of select="@size"/>
+                <xsl:text>];</xsl:text>
+                <xsl:call-template name="linebreak"/>
+            </xsl:when>
             <xsl:when test="substring(@type, string-length(@type) - 1) = '[]'">
                 <xsl:call-template name="indent"/>
                 <xsl:call-template name="indent"/>
@@ -152,6 +162,14 @@ public abstract class </xsl:text><xsl:value-of select="@name"/><xsl:text>Abstrac
     <xsl:call-template name="indent"/>
     <xsl:text>}</xsl:text>
     <xsl:call-template name="linebreak"/>
+    <xsl:text>
+    public byte[] serialize()
+    {
+        final byte[] result = new byte[ getSize() ];
+        serialize( result, 0 );
+        return result;
+    }
+</xsl:text>
     <xsl:text>
     /**
      * Size of record