Package org.alfresco.encoding
Class GuessEncodingCharsetFinder
- java.lang.Object
-
- org.alfresco.encoding.AbstractCharactersetFinder
-
- org.alfresco.encoding.GuessEncodingCharsetFinder
-
- All Implemented Interfaces:
CharactersetFinder
public class GuessEncodingCharsetFinder extends AbstractCharactersetFinder
Uses the Guess Encoding library.- Since:
- 2.1
- Author:
- Derek Hulley
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GuessEncodingCharsetFinder.DummyCharset
A dummy charset to detect a default hit.
-
Constructor Summary
Constructors Constructor Description GuessEncodingCharsetFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.nio.charset.Charset
detectCharsetImpl(byte[] buffer)
Worker method for implementations to override.-
Methods inherited from class org.alfresco.encoding.AbstractCharactersetFinder
detectCharset, detectCharset, getBufferSize, setBufferSize
-
-
-
-
Method Detail
-
detectCharsetImpl
protected java.nio.charset.Charset detectCharsetImpl(byte[] buffer) throws java.lang.Exception
Description copied from class:AbstractCharactersetFinder
Worker method for implementations to override. All exceptions will be reported and absorbed and null returned.The interface contract is that the data buffer must not be altered in any way.
- Specified by:
detectCharsetImpl
in classAbstractCharactersetFinder
- Parameters:
buffer
- the buffer of data no bigger than the requested best buffer size. This can, very efficiently, be turned into an InputStream using a ByteArrayInputStream.- Returns:
- Returns the charset or null if an accurate conclusion is not possible
- Throws:
java.lang.Exception
- Any exception, checked or not
-
-