(int stringRef)
| 60 | } |
| 61 | |
| 62 | public String getString(int stringRef) |
| 63 | { |
| 64 | String string = null; |
| 65 | try |
| 66 | { |
| 67 | int refid = stringRef & 0xFFFFFF; |
| 68 | if (refid < this.stringCount) { |
| 69 | byte[] buffer = new byte[40]; |
| 70 | this.in.seek(this.entryOffset + refid * 40); |
| 71 | int count = this.in.read(buffer); |
| 72 | if (count != buffer.length) { |
| 73 | throw new DBException(new StringBuilder().append("String entry truncated for reference ").append(refid).toString()); |
| 74 | } |
| 75 | |
| 76 | if ((buffer[0] & 0x1) != 0) { |
| 77 | int offset = getInteger(buffer, 28); |
| 78 | int length = getInteger(buffer, 32); |
| 79 | byte[] data = new byte[length]; |
| 80 | this.in.seek(this.stringOffset + offset); |
| 81 | count = this.in.read(data); |
| 82 | if (count != length) { |
| 83 | throw new DBException(new StringBuilder().append("String data truncated for reference ").append(refid).toString()); |
| 84 | } |
| 85 | string = new String(data, "UTF-8"); |
| 86 | } |
| 87 | } |
| 88 | } catch (DBException exc) { |
| 89 | Main.logException("String database format error", exc); |
| 90 | } catch (IOException exc) { |
| 91 | Main.logException("Unable to read string database", exc); |
| 92 | } |
| 93 | |
| 94 | return string != null ? string : new String(); |
| 95 | } |
| 96 | |
| 97 | public String getLabel(int stringRef) |
| 98 | { |
no test coverage detected