1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 import org.apache.poi.util.LittleEndian; 22 23 30 31 public class InterfaceHdrRecord 32 extends Record 33 { 34 public final static short sid = 0xe1; 35 private short field_1_codepage; 37 40 41 public final static short CODEPAGE = ( short ) 0x4b0; 42 43 public InterfaceHdrRecord() 44 { 45 } 46 47 54 55 public InterfaceHdrRecord(short id, short size, byte [] data) 56 { 57 super(id, size, data); 58 } 59 60 68 69 public InterfaceHdrRecord(short id, short size, byte [] data, int offset) 70 { 71 super(id, size, data, offset); 72 } 73 74 protected void validateSid(short id) 75 { 76 if (id != sid) 77 { 78 throw new RecordFormatException("NOT A INTERFACEHDR RECORD"); 79 } 80 } 81 82 protected void fillFields(byte [] data, short size, int offset) 83 { 84 field_1_codepage = LittleEndian.getShort(data, 0 + offset); 85 } 86 87 93 94 public void setCodepage(short cp) 95 { 96 field_1_codepage = cp; 97 } 98 99 105 106 public short getCodepage() 107 { 108 return field_1_codepage; 109 } 110 111 public String toString() 112 { 113 StringBuffer buffer = new StringBuffer (); 114 115 buffer.append("[INTERFACEHDR]\n"); 116 buffer.append(" .codepage = ") 117 .append(Integer.toHexString(getCodepage())).append("\n"); 118 buffer.append("[/INTERFACEHDR]\n"); 119 return buffer.toString(); 120 } 121 122 public int serialize(int offset, byte [] data) 123 { 124 LittleEndian.putShort(data, 0 + offset, sid); 125 LittleEndian.putShort(data, 2 + offset, 126 (( short ) 0x02)); LittleEndian.putShort(data, 4 + offset, getCodepage()); 128 return getRecordSize(); 129 } 130 131 public int getRecordSize() 132 { 133 return 6; 134 } 135 136 public short getSid() 137 { 138 return this.sid; 139 } 140 } 141 | Popular Tags |