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 PrecisionRecord 33 extends Record 34 { 35 public final static short sid = 0xE; 36 public short field_1_precision; 37 38 public PrecisionRecord() 39 { 40 } 41 42 49 50 public PrecisionRecord(short id, short size, byte [] data) 51 { 52 super(id, size, data); 53 } 54 55 63 64 public PrecisionRecord(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 PRECISION RECORD"); 74 } 75 } 76 77 protected void fillFields(byte [] data, short size, int offset) 78 { 79 field_1_precision = LittleEndian.getShort(data, 0 + offset); 80 } 81 82 87 88 public void setFullPrecision(boolean fullprecision) 89 { 90 if (fullprecision == true) 91 { 92 field_1_precision = 1; 93 } 94 else 95 { 96 field_1_precision = 0; 97 } 98 } 99 100 105 106 public boolean getFullPrecision() 107 { 108 return (field_1_precision == 1); 109 } 110 111 public String toString() 112 { 113 StringBuffer buffer = new StringBuffer (); 114 115 buffer.append("[PRECISION]\n"); 116 buffer.append(" .precision = ").append(getFullPrecision()) 117 .append("\n"); 118 buffer.append("[/PRECISION]\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, field_1_precision); 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 |