poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1187634 - /poi/trunk/src/java/org/apache/poi/hpsf/Filetime.java
Date Sat, 22 Oct 2011 01:57:58 GMT
Author: sergey
Date: Sat Oct 22 01:57:58 2011
New Revision: 1187634

URL: http://svn.apache.org/viewvc?rev=1187634&view=rev
Log:
fix type definition

Modified:
    poi/trunk/src/java/org/apache/poi/hpsf/Filetime.java

Modified: poi/trunk/src/java/org/apache/poi/hpsf/Filetime.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/Filetime.java?rev=1187634&r1=1187633&r2=1187634&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/Filetime.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/Filetime.java Sat Oct 22 01:57:58 2011
@@ -1,17 +1,54 @@
 package org.apache.poi.hpsf;
 
+import java.io.IOException;
+import java.io.OutputStream;
+
 import org.apache.poi.util.LittleEndian;
 
 class Filetime
 {
-    static final int SIZE = LittleEndian.LONG_SIZE * 2;
+    static final int SIZE = LittleEndian.INT_SIZE * 2;
 
-    private long _dwLowDateTime;
-    private long _dwHighDateTime;
+    private int _dwHighDateTime;
+    private int _dwLowDateTime;
 
     Filetime( byte[] data, int offset )
     {
-        _dwLowDateTime = LittleEndian.getLong( data, offset + 0 );
-        _dwHighDateTime = LittleEndian.getLong( data, offset + 4 );
+        _dwLowDateTime = LittleEndian.getInt( data, offset + 0
+                * LittleEndian.INT_SIZE );
+        _dwHighDateTime = LittleEndian.getInt( data, offset + 1
+                * LittleEndian.INT_SIZE );
+    }
+
+    Filetime( int low, int high )
+    {
+        _dwLowDateTime = low;
+        _dwHighDateTime = high;
+    }
+
+    long getHigh()
+    {
+        return _dwHighDateTime;
+    }
+
+    long getLow()
+    {
+        return _dwLowDateTime;
+    }
+
+    byte[] toByteArray()
+    {
+        byte[] result = new byte[SIZE];
+        LittleEndian.putInt( result, 0 * LittleEndian.INT_SIZE, _dwLowDateTime );
+        LittleEndian
+                .putInt( result, 1 * LittleEndian.INT_SIZE, _dwHighDateTime );
+        return result;
+    }
+
+    int write( OutputStream out ) throws IOException
+    {
+        LittleEndian.putInt( _dwLowDateTime, out );
+        LittleEndian.putInt( _dwHighDateTime, out );
+        return SIZE;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message