aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/hpsf
diff options
context:
space:
mode:
authorRainer Klute <klute@apache.org>2005-04-13 16:33:22 +0000
committerRainer Klute <klute@apache.org>2005-04-13 16:33:22 +0000
commite33d4f7cd18e8b8730c28b4969e5dbe237102b78 (patch)
tree57ab87cc327ab4a1b0f210e98cfca23b45a4e91b /src/java/org/apache/poi/hpsf
parent1a5920f221eb3d1b124c9733af5957429efc148f (diff)
downloadpoi-e33d4f7cd18e8b8730c28b4969e5dbe237102b78.tar.gz
poi-e33d4f7cd18e8b8730c28b4969e5dbe237102b78.zip
- Support for variant type VT_R8 added.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353637 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/hpsf')
-rw-r--r--src/java/org/apache/poi/hpsf/TypeWriter.java20
-rw-r--r--src/java/org/apache/poi/hpsf/VariantSupport.java15
2 files changed, 32 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/hpsf/TypeWriter.java b/src/java/org/apache/poi/hpsf/TypeWriter.java
index 3f0f488002..c88e98d07b 100644
--- a/src/java/org/apache/poi/hpsf/TypeWriter.java
+++ b/src/java/org/apache/poi/hpsf/TypeWriter.java
@@ -169,8 +169,22 @@ public class TypeWriter
-
-
-
+ /**
+ * <p>Writes a double value value to an output stream.</p>
+ *
+ * @param out The stream to write to.
+ * @param n The value to write.
+ * @exception IOException if an I/O error occurs
+ * @return The number of bytes written to the output stream.
+ */
+ public static int writeToStream(final OutputStream out, final double n)
+ throws IOException
+ {
+ final int l = LittleEndian.DOUBLE_SIZE;
+ final byte[] buffer = new byte[l];
+ LittleEndian.putDouble(buffer, 0, n);
+ out.write(buffer, 0, l);
+ return l;
+ }
}
diff --git a/src/java/org/apache/poi/hpsf/VariantSupport.java b/src/java/org/apache/poi/hpsf/VariantSupport.java
index 081e7f4dd4..b9ab14ffca 100644
--- a/src/java/org/apache/poi/hpsf/VariantSupport.java
+++ b/src/java/org/apache/poi/hpsf/VariantSupport.java
@@ -169,6 +169,15 @@ public class VariantSupport extends Variant
value = new Long(LittleEndian.getUInt(src, o1));
break;
}
+ case Variant.VT_R8:
+ {
+ /*
+ * Read an eight-byte double value. In Java it is represented as
+ * a Double object.
+ */
+ value = new Double(LittleEndian.getDouble(src, o1));
+ break;
+ }
case Variant.VT_FILETIME:
{
/*
@@ -394,6 +403,12 @@ public class VariantSupport extends Variant
((Long) value).intValue());
break;
}
+ case Variant.VT_R8:
+ {
+ length += TypeWriter.writeToStream(out,
+ ((Double) value).doubleValue());
+ break;
+ }
case Variant.VT_FILETIME:
{
long filetime = Util.dateToFileTime((Date) value);