1 19 20 package jxl.read.biff; 21 22 import java.io.UnsupportedEncodingException ; 23 24 import jxl.biff.IntegerHelper; 25 import jxl.biff.RecordData; 26 27 30 class BoundsheetRecord extends RecordData 31 { 32 35 private int offset; 36 39 private byte typeFlag; 40 43 private byte visibilityFlag; 44 47 private int length; 48 51 private String name; 52 53 56 private static class Biff7 {}; 57 public static Biff7 biff7 = new Biff7(); 58 59 64 public BoundsheetRecord(Record t) 65 { 66 super(t); 67 byte[] data = getRecord().getData(); 68 offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); 69 typeFlag = data[5]; 70 visibilityFlag = data[4]; 71 length = data[6]; 72 73 if (data[7] == 0) 74 { 75 byte[] bytes = new byte[length]; 77 System.arraycopy(data, 8, bytes, 0, length); 78 name = new String (bytes); 79 } 80 else 81 { 82 byte[] bytes = new byte[length * 2]; 84 System.arraycopy(data, 8, bytes, 0, length * 2); 85 try 86 { 87 name = new String (bytes, "UnicodeLittle"); 88 } 89 catch (UnsupportedEncodingException e) 90 { 91 name = "Error"; 93 } 94 } 95 } 96 97 98 105 public BoundsheetRecord(Record t, Biff7 biff7) 106 { 107 super(t); 108 byte[] data = getRecord().getData(); 109 offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); 110 typeFlag = data[5]; 111 visibilityFlag = data[4]; 112 length = data[6]; 113 byte[] bytes = new byte[length]; 114 System.arraycopy(data, 7, bytes, 0, length); 115 name = new String (bytes); 116 } 117 118 123 public String getName() 124 { 125 return name; 126 } 127 128 133 public boolean isHidden() 134 { 135 return visibilityFlag != 0; 136 } 137 138 144 public boolean isSheet() 145 { 146 return typeFlag == 0; 147 } 148 149 154 public boolean isChart() 155 { 156 return typeFlag == 2; 157 } 158 159 } 160 161 162 163 164 | Popular Tags |