Module jEdit

Class AutoDetection

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

public class AutoDetection extends Object
Some functions for auto detection of I/O stream properties.
  • Constructor Details

    • AutoDetection

      public AutoDetection()
  • Method Details

    • getMarkedStream

      public static BufferedInputStream getMarkedStream(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(InputStream sample) throws 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:
      IOException
    • getEncodingDetectors

      public static List<EncodingDetector> getEncodingDetectors()
      Returns the user configured ordered list of encoding detectors. This method reads property "encodingDetectors".
    • getDetectedEncoding

      public static String getDetectedEncoding(BufferedInputStream markedStream) throws IOException
      Returns an auto detected encoding from content of markedStream. This method assumes that markedStream is wrapped by getMarkedStream() method.
      Throws:
      IOException