diff options
author | Sergey Vladimirov <sergey@apache.org> | 2011-10-22 01:57:58 +0000 |
---|---|---|
committer | Sergey Vladimirov <sergey@apache.org> | 2011-10-22 01:57:58 +0000 |
commit | efd3316058ab2c9fab0265ccf77af76e5b057e27 (patch) | |
tree | 02a8def8881d70b9c5adb16ec9f69956cd2ffe50 /src/java/org/apache/poi/hpsf | |
parent | 5005fe6ce00079777951d10eb432bc0e1612af66 (diff) | |
download | poi-efd3316058ab2c9fab0265ccf77af76e5b057e27.tar.gz poi-efd3316058ab2c9fab0265ccf77af76e5b057e27.zip |
fix type definition
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1187634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/hpsf')
-rw-r--r-- | src/java/org/apache/poi/hpsf/Filetime.java | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/src/java/org/apache/poi/hpsf/Filetime.java b/src/java/org/apache/poi/hpsf/Filetime.java index 99aa23bae2..bb7c3ff179 100644 --- a/src/java/org/apache/poi/hpsf/Filetime.java +++ b/src/java/org/apache/poi/hpsf/Filetime.java @@ -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; } } |