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 UseSelFSRecord 33 extends Record 34 { 35 public final static short sid = 0x160; 36 public final static short TRUE = 1; 37 public final static short FALSE = 0; 38 private short field_1_flag; 39 40 public UseSelFSRecord() 41 { 42 } 43 44 51 52 public UseSelFSRecord(short id, short size, byte [] data) 53 { 54 super(id, size, data); 55 } 56 57 65 66 public UseSelFSRecord(short id, short size, byte [] data, int offset) 67 { 68 super(id, size, data, offset); 69 } 70 71 protected void validateSid(short id) 72 { 73 if (id != sid) 74 { 75 throw new RecordFormatException("NOT A UseSelFS RECORD"); 76 } 77 } 78 79 protected void fillFields(byte [] data, short size, int offset) 80 { 81 field_1_flag = LittleEndian.getShort(data, 0 + offset); 82 } 83 84 91 92 public void setFlag(short flag) 93 { 94 field_1_flag = flag; 95 } 96 97 104 105 public short getFlag() 106 { 107 return field_1_flag; 108 } 109 110 public String toString() 111 { 112 StringBuffer buffer = new StringBuffer (); 113 114 buffer.append("[USESELFS]\n"); 115 buffer.append(" .flag = ") 116 .append(Integer.toHexString(getFlag())).append("\n"); 117 buffer.append("[/USESELFS]\n"); 118 return buffer.toString(); 119 } 120 121 public int serialize(int offset, byte [] data) 122 { 123 LittleEndian.putShort(data, 0 + offset, sid); 124 LittleEndian.putShort(data, 2 + offset, 125 (( short ) 0x02)); LittleEndian.putShort(data, 4 + offset, getFlag()); 127 return getRecordSize(); 128 } 129 130 public int getRecordSize() 131 { 132 return 6; 133 } 134 135 public short getSid() 136 { 137 return this.sid; 138 } 139 } 140 | Popular Tags |