1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 24 import org.apache.poi.util.*; 25 26 33 public class NumberFormatIndexRecord 34 extends Record 35 { 36 public final static short sid = 0x104e; 37 private short field_1_formatIndex; 38 39 40 public NumberFormatIndexRecord() 41 { 42 43 } 44 45 53 54 public NumberFormatIndexRecord(short id, short size, byte [] data) 55 { 56 super(id, size, data); 57 58 } 59 60 69 70 public NumberFormatIndexRecord(short id, short size, byte [] data, int offset) 71 { 72 super(id, size, data, offset); 73 74 } 75 76 81 protected void validateSid(short id) 82 { 83 if (id != sid) 84 { 85 throw new RecordFormatException("Not a NumberFormatIndex record"); 86 } 87 } 88 89 protected void fillFields(byte [] data, short size, int offset) 90 { 91 92 int pos = 0; 93 field_1_formatIndex = LittleEndian.getShort(data, pos + 0x0 + offset); 94 95 } 96 97 public String toString() 98 { 99 StringBuffer buffer = new StringBuffer (); 100 101 buffer.append("[IFMT]\n"); 102 buffer.append(" .formatIndex = ") 103 .append("0x").append(HexDump.toHex( getFormatIndex ())) 104 .append(" (").append( getFormatIndex() ).append(" )"); 105 buffer.append(System.getProperty("line.separator")); 106 107 buffer.append("[/IFMT]\n"); 108 return buffer.toString(); 109 } 110 111 public int serialize(int offset, byte[] data) 112 { 113 int pos = 0; 114 115 LittleEndian.putShort(data, 0 + offset, sid); 116 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); 117 118 LittleEndian.putShort(data, 4 + offset + pos, field_1_formatIndex); 119 120 return getRecordSize(); 121 } 122 123 126 public int getRecordSize() 127 { 128 return 4 + 2; 129 } 130 131 public short getSid() 132 { 133 return this.sid; 134 } 135 136 public Object clone() { 137 NumberFormatIndexRecord rec = new NumberFormatIndexRecord(); 138 139 rec.field_1_formatIndex = field_1_formatIndex; 140 return rec; 141 } 142 143 144 145 146 149 public short getFormatIndex() 150 { 151 return field_1_formatIndex; 152 } 153 154 157 public void setFormatIndex(short field_1_formatIndex) 158 { 159 this.field_1_formatIndex = field_1_formatIndex; 160 } 161 162 163 } 165 166 167 168 | Popular Tags |