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 DSFRecord 33 extends Record 34 { 35 public final static short sid = 0x161; 36 private short field_1_dsf; 37 38 public DSFRecord() 39 { 40 } 41 42 49 50 public DSFRecord(short id, short size, byte [] data) 51 { 52 super(id, size, data); 53 } 54 55 63 64 public DSFRecord(short id, short size, byte [] data, int offset) 65 { 66 super(id, size, data, offset); 67 } 68 69 protected void validateSid(short id) 70 { 71 if (id != sid) 72 { 73 throw new RecordFormatException("NOT A DSF RECORD"); 74 } 75 } 76 77 protected void fillFields(byte [] data, short size, int offset) 78 { 79 field_1_dsf = LittleEndian.getShort(data, 0 + offset); 80 } 81 82 86 87 public void setDsf(short dsfflag) 88 { 89 field_1_dsf = dsfflag; 90 } 91 92 96 97 public short getDsf() 98 { 99 return field_1_dsf; 100 } 101 102 public String toString() 103 { 104 StringBuffer buffer = new StringBuffer (); 105 106 buffer.append("[DSF]\n"); 107 buffer.append(" .isDSF = ") 108 .append(Integer.toHexString(getDsf())).append("\n"); 109 buffer.append("[/DSF]\n"); 110 return buffer.toString(); 111 } 112 113 public int serialize(int offset, byte [] data) 114 { 115 LittleEndian.putShort(data, 0 + offset, sid); 116 LittleEndian.putShort(data, 2 + offset, 117 (( short ) 0x02)); LittleEndian.putShort(data, 4 + offset, getDsf()); 119 return getRecordSize(); 120 } 121 122 public int getRecordSize() 123 { 124 return 6; 125 } 126 127 public short getSid() 128 { 129 return this.sid; 130 } 131 } 132 | Popular Tags |