@Override
    public String getEncoding(final String feedName,
                              final String streamTypeName,
                              final String childStreamTypeName) throws UnsupportedEncodingException {

        final Optional<FeedDoc> optionalFeedDoc = feedDocCache.get(feedName);
        if (optionalFeedDoc.isPresent()) {
            final FeedDoc feedDoc = optionalFeedDoc.get();

            if (StreamTypeNames.CONTEXT.equals(childStreamTypeName)) {
                return resolveEncoding(feedName, childStreamTypeName, feedDoc.getContextEncoding());

            } else if (childStreamTypeName == null
                    && metaService.isRaw(streamTypeName)) {
                // Child stream type is null for the data child streams
                return resolveEncoding(feedName, streamTypeName, feedDoc.getEncoding());

            } else {
                return StreamUtil.DEFAULT_CHARSET_NAME;
            }
        }
        return StreamUtil.DEFAULT_CHARSET_NAME;
    }
@param feedName            The feed name.
@param streamTypeName      The name of the stream type, e.g. Raw Reference
@param childStreamTypeName The name of the child stream type, e.g. Context, or null for the data child stream
                           or if not applicable
@return The applicable encoding
stroom-feed/stroom-feed-impl/src/main/java/stroom/feed/impl/FeedPropertiesImpl.java