ch = (char) r; if (ch == '\r') { continue;
switch (state) { case 0: switch (b) { case '\r': state = 1; break; case '\"': state = 2; default: baos.write(b); } break; case 1: if (b == '\n') { state = -1; } else { throw new IOException("Protocol violation: Unexpected single newline character in chunk size"); } break; case 2: switch (b) { case '\\': b = mySource.read(); baos.write(b); break; case '\"': state = 0; default: baos.write(b); } break; default: throw new IOException("Assertion failed while reading chunk length");
    private int readChunkLength() throws IOException {        int ch = 0;        StringBuffer sb = new StringBuffer();        while(true) {            int r = mySource.read();            if (r < 0) {                return 0;            }            ch = (char) r;            if (ch == '\r') {                continue;            }            if (ch == '\n' || ch == '\r') {                if (sb.length() == 0) {                    continue;                }                break;            }            sb.append((char) ch);        }        return Integer.parseInt(sb.toString(), 16);    }