org.gjt.sp.jedit.io

## Class AutoDetection

- java.lang.Object
- - org.gjt.sp.jedit.io.AutoDetection

-     public class AutoDetection
      extends java.lang.Object

  Some functions for auto detection of I/O stream properties.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AutoDetection.Result` An utility class to hold the result of some auto detections.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AutoDetection()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `getDetectedEncoding(java.io.BufferedInputStream markedStream)` Returns an auto detected encoding from content of markedStream.
    `static java.util.List<EncodingDetector>` | `getEncodingDetectors()` Returns the user configured ordered list of encoding detectors.
    `static java.io.BufferedInputStream` | `getMarkedStream(java.io.InputStream in)` Returns a marked, rewindable stream.
    `static boolean` | `isGzipped(java.io.InputStream sample)` Returns wheather the stream is gzipped.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AutoDetection

          public AutoDetection()

  - ### Method Detail

    - #### getMarkedStream

          public static java.io.BufferedInputStream getMarkedStream(java.io.InputStream in)

      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

          public static boolean isGzipped(java.io.InputStream sample)
                                   throws java.io.IOException

      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:
        `java.io.IOException`

    - #### getEncodingDetectors

          public static java.util.List<EncodingDetector> getEncodingDetectors()

      Returns the user configured ordered list of encoding detectors. This method reads property "encodingDetectors".

    - #### getDetectedEncoding

          public static java.lang.String getDetectedEncoding(java.io.BufferedInputStream markedStream)
                                                      throws java.io.IOException

      Returns an auto detected encoding from content of markedStream. This method assumes that markedStream is wrapped by getMarkedStream() method.
      Throws:
        `java.io.IOException`