Interface Detector

  • All Known Implementing Classes:
    AbstractDetector

    public interface Detector
    Abstract superclass of all Detectors used for language and encoding detection.
    Author:
    Einar M R Rosenvinge
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Detection detect​(byte[] input, int offset, int length, Hint hint)
      Detects language and encoding of the supplied byte array, possibly using a language/encoding hint.
      Detection detect​(java.lang.String input, Hint hint)
      Detects language of the supplied String, possibly using a language hint.
      Detection detect​(java.nio.ByteBuffer input, Hint hint)
      Detects language and encoding of the supplied ByteBuffer, possibly using a language/encoding hint.
    • Method Detail

      • detect

        Detection detect​(byte[] input,
                         int offset,
                         int length,
                         Hint hint)
        Detects language and encoding of the supplied byte array, possibly using a language/encoding hint.
        Parameters:
        input - the buffer that is to be inspected
        offset - the offset to detect from
        length - the size to detect from
        hint - a hint to the detector, or null for no hint
        Returns:
        an array of possible language/encoding pairs, sorted by decreasing confidence (possibly empty, but never null)
        Throws:
        DetectionException - if detection fails
      • detect

        Detection detect​(java.nio.ByteBuffer input,
                         Hint hint)
        Detects language and encoding of the supplied ByteBuffer, possibly using a language/encoding hint.
        Parameters:
        input - the buffer that is to be inspected, from its current position to its limit
        hint - a hint to the detector, or null for no hint
        Returns:
        an array of possible language/encoding pairs, sorted by decreasing confidence (possibly empty, but never null)
        Throws:
        DetectionException - if detection fails
      • detect

        Detection detect​(java.lang.String input,
                         Hint hint)
        Detects language of the supplied String, possibly using a language hint.
        Parameters:
        input - the string that is to be inspected
        hint - a hint to the detector, or null for no hint
        Returns:
        an array of possible language/encoding pairs, sorted by decreasing confidence (possibly empty, but never null)
        Throws:
        DetectionException - if detection fails