detectGraphCodec method
- String content
Detect codec from content when no MIME type is available
Attempts to identify the codec by examining the content structure. Each registered codec is asked if it can parse the content in the order in which they were registered, and the first one that responds positively is returned.
The content
parameter is the content string to analyze.
Returns the first codec that claims it can parse the content, or null if none found.
Implementation
RdfGraphCodec? detectGraphCodec(String content) {
_logger.fine('Attempting to detect codec from content');
for (final codec in _graphCodecs) {
if (codec.canParse(content)) {
_logger.fine('Detected codec: ${codec.primaryMimeType}');
return codec;
}
}
_logger.fine('No codec detected');
return null;
}