1 2 17 18 19 package org.apache.poi.hssf.record; 20 21 32 33 public abstract class Record 34 { 35 36 39 40 public Record() 41 { 42 } 43 44 51 52 public Record(short id, short size, byte [] data) 53 { 54 validateSid(id); 55 fillFields(data, size); 56 } 57 58 65 66 public Record(short id, short size, byte [] data, int offset) 67 { 68 validateSid(id); 69 fillFields(data, size, offset); 70 } 71 72 78 79 protected abstract void validateSid(short id); 80 81 87 88 protected void fillFields(byte [] data, short size) 89 { 90 fillFields(data, size, 0); 91 } 92 93 101 102 protected abstract void fillFields(byte [] data, short size, int offset); 103 104 111 112 public byte [] serialize() 113 { 114 byte[] retval = new byte[ getRecordSize() ]; 115 116 serialize(0, retval); 117 return retval; 118 } 119 120 129 130 public abstract int serialize(int offset, byte [] data); 131 132 135 136 public int getRecordSize() 137 { 138 139 return serialize().length; 142 } 143 144 147 148 public boolean isValue() 149 { 150 return false; 151 } 152 153 156 157 public boolean isInValueSection() 158 { 159 return false; 160 } 161 162 165 166 public String toString() 167 { 168 return super.toString(); 169 } 170 171 177 178 180 181 public void processContinueRecord(byte [] record) 182 { 183 184 } 186 187 190 191 public abstract short getSid(); 192 193 public Object clone() { 194 throw new RuntimeException ("The class "+getClass().getName()+" needs to define a clone method"); 195 } 196 } 197 | Popular Tags |