java.lang.Object
org.gjt.sp.jedit.io.RegexEncodingDetector
- All Implemented Interfaces:
EncodingDetector
An encoding detector which finds regex pattern.
This reads the sample in the system default encoding for first some
lines and look for a regex pattern. This can fail if the
stream cannot be read in the system default encoding or the
pattern is not found at near the top of the stream.
- Since:
- 4.3pre16
- Author:
- Kazutoshi Satoda
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
A regex pattern matches to "Charset names" specified for java.nio.charset.Charset. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondetectEncoding
(InputStream sample) Returns the name of a detected encoding for the bytes in sample.
-
Field Details
-
VALID_ENCODING_PATTERN
A regex pattern matches to "Charset names" specified for java.nio.charset.Charset.- See Also:
-
-
Constructor Details
-
RegexEncodingDetector
-
-
Method Details
-
detectEncoding
Description copied from interface:EncodingDetector
Returns the name of a detected encoding for the bytes in sample. Returns null if this instance could not detect reasonable one.- Specified by:
detectEncoding
in interfaceEncodingDetector
- Throws:
IOException
-