org.gjt.sp.jedit.io
Class BufferLocalEncodingDetector

java.lang.Object
  extended by org.gjt.sp.jedit.io.BufferLocalEncodingDetector
All Implemented Interfaces:
EncodingDetector

public class BufferLocalEncodingDetector
extends java.lang.Object
implements EncodingDetector

An encoding detector which finds buffer-local-property syntax. This reads the sample in the system default encoding for first 10 lines and look for ":encoding=..." syntax. This can fail if the stream cannot be read in the system default encoding or ":encoding=..." is not placed at near the top of the stream.

Since:
4.3pre10

Constructor Summary
BufferLocalEncodingDetector()
           
 
Method Summary
 java.lang.String detectEncoding(java.io.InputStream sample)
          Returns the name of a detected encoding for the bytes in sample.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferLocalEncodingDetector

public BufferLocalEncodingDetector()
Method Detail

detectEncoding

public java.lang.String detectEncoding(java.io.InputStream sample)
                                throws java.io.IOException
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 interface EncodingDetector
Throws:
java.io.IOException