protected String decodeString(IsoReader reader, char c) throws IOException {
StringBuilder builder = new StringBuilder();
while (true) {
int ch = reader.read();
if (ch < 0) {
throw new IsoTextCodingException();
}
if (ch == '"') {
break;
}
c = (char) ch;
if (c == '\\') {
ch = reader.read();
if (ch < 0) {
throw new IsoTextCodingException();
}
switch (ch) {
case '"':
case '\\':
case '/':
break;
case 'b':
ch = '\b';
break;
case 'f':
ch = '\f';
break;
case 'n':
ch = '\n';
break;
case 'r':
ch = '\r';
break;
case 't':
ch = '\t';
break;
case 'u':
char[] cbuf = new char[4];
int count = reader.read(cbuf);
if (count < 0) {
throw new IsoTextCodingException();
}
if (count != cbuf.length) {
throw new IsoTextCodingException();
}
try {
long l = Long.parseLong(new String(cbuf), 16);
if (l < 0) {
throw new IsoTextCodingException();
}
ch = (char) l;
} catch (NumberFormatException exception) {
throw new IsoTextCodingException(exception);
}
break;
default:
throw new IsoTextCodingException();
}
}
builder.append((char) ch);
}
return builder.toString();