1 16 17 18 19 package org.apache.poi.hwpf.usermodel; 20 21 import org.apache.poi.util.BitField; 22 import org.apache.poi.util.LittleEndian; 23 24 29 public class DateAndTime 30 implements Cloneable 31 { 32 public static final int SIZE = 4; 33 private short _info; 34 private static final BitField _minutes = new BitField(0x3f); 35 private static final BitField _hours = new BitField(0x7c0); 36 private static final BitField _dom = new BitField(0xf800); 37 private short _info2; 38 private static final BitField _months = new BitField(0xf); 39 private static final BitField _years = new BitField(0x1ff0); 40 private static final BitField _weekday = new BitField(0xe000); 41 42 public DateAndTime() 43 { 44 } 45 46 public DateAndTime(byte[] buf, int offset) 47 { 48 _info = LittleEndian.getShort(buf, offset); 49 _info2 = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE); 50 } 51 52 public void serialize(byte[] buf, int offset) 53 { 54 LittleEndian.putShort(buf, offset, _info); 55 LittleEndian.putShort(buf, offset + LittleEndian.SHORT_SIZE, _info2); 56 } 57 58 public boolean equals(Object o) 59 { 60 DateAndTime dttm = (DateAndTime)o; 61 return _info == dttm._info && _info2 == dttm._info2; 62 } 63 64 public Object clone() 65 throws CloneNotSupportedException 66 { 67 return super.clone(); 68 } 69 } 70 | Popular Tags |