java.lang.Object
org.gjt.sp.jedit.io.AutoDetection
Some functions for auto detection of I/O stream properties.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An utility class to hold the result of some auto detections. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getDetectedEncoding
(BufferedInputStream markedStream) Returns an auto detected encoding from content of markedStream.static List<EncodingDetector>
Returns the user configured ordered list of encoding detectors.static BufferedInputStream
Returns a marked, rewindable stream.static boolean
isGzipped
(InputStream sample) Returns wheather the stream is gzipped.
-
Constructor Details
-
AutoDetection
public AutoDetection()
-
-
Method Details
-
getMarkedStream
Returns a marked, rewindable stream. Calling reset() method rewinds the stream to its beginning. But reset() can fail if too long bytes were read. -
isGzipped
Returns wheather the stream is gzipped. This method reads a few bytes from the sample. So a caller must take care of mark() to reuse the contents. Wraping the stream by getMarkedStream() is suitable.- Throws:
IOException
-
getEncodingDetectors
Returns the user configured ordered list of encoding detectors. This method reads property "encodingDetectors". -
getDetectedEncoding
Returns an auto detected encoding from content of markedStream. This method assumes that markedStream is wrapped by getMarkedStream() method.- Throws:
IOException
-