Interface Detector

All Known Implementing Classes:
AbstractDetector, SimpleDetector

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

    Modifier and Type
    Method
    Description
    detect(byte[] input, int offset, int length, Hint hint)
    Detects language and encoding of the supplied byte array, possibly using a language/encoding hint.
    detect(String input, Hint hint)
    Detects language of the supplied String, possibly using a language hint.
    detect(ByteBuffer input, Hint hint)
    Detects language and encoding of the supplied ByteBuffer, possibly using a language/encoding hint.
  • Method Details

    • 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(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(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