private byte[] internalReadChunkedBytes() throws IOException {
        ArrayList<byte[]> chunks = new ArrayList();
        int code = Codes.BYTES_CHUNK;
        while (code == Codes.BYTES_CHUNK) {
            chunks.add(internalReadBytes(readCount()));
            code = readNextCode();
        }
        if (code != Codes.BYTES) {
            throw expected("conclusion of chunked bytes", code);
        }
        chunks.add(internalReadBytes(readCount()));
        int length = 0;
        for (int n=0; n < chunks.size(); n++) {
            length = length + chunks.get(n).length;
        }
        byte[] result = new byte[length];
        int pos = 0;
        for (int n=0; n < chunks.size(); n++) {
            System.arraycopy(chunks.get(n), 0, result, pos, chunks.get(n).length);
            pos += chunks.get(n).length;
        }
        return result;
    }