Package dev.enola.common.io.mediatype
Interface ResourceCharsetDetector
- All Known Implementing Classes:
ResourceCharsetDetectorSPI,YamlMediaType
public interface ResourceCharsetDetector
Detects the Charset of a Resource.
This interface is typically not used directly by Resource API users (who would just
use MediaType.charset() on an AbstractResource.mediaType()). Instead, it is
normally implemented by (some) *MediaType API implementations, for Charset detection
that is specific to a given MediaType (if any). For example, RFC 4627 §3 specifies how to
determine the encoding of JSON, or https://yaml.org/spec §5.2. specifies ditto for YAML.
-
Method Summary
Modifier and TypeMethodDescriptiondetectCharset(URI uri, ByteSource source) Detect theCharsetby "sniffing" the source e.g.
-
Method Details
-
detectCharset
Detect theCharsetby "sniffing" the source e.g. for "BOM detection". The URI argument is only uses for error messages. (It's never "accessed".)
-