class CachedResponseTranscoder implements Transcoder<CachedResponse> {

    @Override
    public CachedResponse decode(CachedData d) {
        try {
            byte[] cachedData = d.getData();
            int headerSeparatorIndex = Bytes.indexOf(cachedData, HEADER_SEPARATOR);

            if (headerSeparatorIndex < 0) {
                return null;
            }

            BufferedReader headerReader = new BufferedReader(new InputStreamReader(
                    new ByteArrayInputStream(cachedData, 0, headerSeparatorIndex),
                    Charsets.US_ASCII)
            );

            int statusCode = readStatusCode(headerReader);
            MultivaluedMap<String, String> headers = readHeaders(headerReader);
            byte[] responseContent = Arrays.copyOfRange(cachedData, headerSeparatorIndex + HEADER_SEPARATOR.length, cachedData.length);

            return new CachedResponse(statusCode, headers, responseContent);
        } catch (IOException ex) {
            throw new RuntimeException("Corrupted cache entry", ex);
        }
    }

    private  CachedResponseTranscoder();

}