1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 31 32 public class DateWindow1904Record 33 extends Record 34 { 35 public final static short sid = 0x22; 36 private short field_1_window; 37 38 public DateWindow1904Record() 39 { 40 } 41 42 49 50 public DateWindow1904Record(short id, short size, byte [] data) 51 { 52 super(id, size, data); 53 } 54 55 63 64 public DateWindow1904Record(short id, short size, byte [] data, 65 int offset) 66 { 67 super(id, size, data, offset); 68 } 69 70 protected void validateSid(short id) 71 { 72 if (id != sid) 73 { 74 throw new RecordFormatException("NOT A 1904 RECORD"); 75 } 76 } 77 78 protected void fillFields(byte [] data, short size, int offset) 79 { 80 field_1_window = LittleEndian.getShort(data, 0 + offset); 81 } 82 83 87 88 public void setWindowing(short window) 89 { field_1_window = window; 91 } 92 93 97 98 public short getWindowing() 99 { 100 return field_1_window; 101 } 102 103 public String toString() 104 { 105 StringBuffer buffer = new StringBuffer (); 106 107 buffer.append("[1904]\n"); 108 buffer.append(" .is1904 = ") 109 .append(Integer.toHexString(getWindowing())).append("\n"); 110 buffer.append("[/1904]\n"); 111 return buffer.toString(); 112 } 113 114 public int serialize(int offset, byte [] data) 115 { 116 LittleEndian.putShort(data, 0 + offset, sid); 117 LittleEndian.putShort(data, 2 + offset, 118 (( short ) 0x02)); LittleEndian.putShort(data, 4 + offset, getWindowing()); 120 return getRecordSize(); 121 } 122 123 public int getRecordSize() 124 { 125 return 6; 126 } 127 128 public short getSid() 129 { 130 return this.sid; 131 } 132 } 133 | Popular Tags |