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 FontIndexRecord 34 extends Record 35 { 36 public final static short sid = 0x1026; 37 private short field_1_fontIndex; 38 39 40 public FontIndexRecord() 41 { 42 43 } 44 45 53 54 public FontIndexRecord(short id, short size, byte [] data) 55 { 56 super(id, size, data); 57 58 } 59 60 69 70 public FontIndexRecord(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 FontIndex record"); 86 } 87 } 88 89 protected void fillFields(byte [] data, short size, int offset) 90 { 91 92 int pos = 0; 93 field_1_fontIndex = LittleEndian.getShort(data, pos + 0x0 + offset); 94 95 } 96 97 public String toString() 98 { 99 StringBuffer buffer = new StringBuffer (); 100 101 buffer.append("[FONTX]\n"); 102 buffer.append(" .fontIndex = ") 103 .append("0x").append(HexDump.toHex( getFontIndex ())) 104 .append(" (").append( getFontIndex() ).append(" )"); 105 buffer.append(System.getProperty("line.separator")); 106 107 buffer.append("[/FONTX]\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_fontIndex); 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 FontIndexRecord rec = new FontIndexRecord(); 138 139 rec.field_1_fontIndex = field_1_fontIndex; 140 return rec; 141 } 142 143 144 145 146 149 public short getFontIndex() 150 { 151 return field_1_fontIndex; 152 } 153 154 157 public void setFontIndex(short field_1_fontIndex) 158 { 159 this.field_1_fontIndex = field_1_fontIndex; 160 } 161 162 163 } 165 166 167 168 | Popular Tags |