MinimalECIInput (ZXing 3.5.2 API)
Description: declaration: package: com.google.zxing.common, class: MinimalECIInput

Package com.google.zxing.common

# Class MinimalECIInput

java.lang.Object
com.google.zxing.common.MinimalECIInput

All Implemented Interfaces:
  `ECIInput`

public class MinimalECIInput extends Object implements ECIInput
Class that converts a character string into a sequence of ECIs and bytes The implementation uses the Dijkstra algorithm to produce minimal encodings

Author:
  Alex Geller

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MinimalECIInput(String stringToEncode, Charset priorityCharset, int fnc1)`
  Constructs a minimal input

- ## Method Summary

  Modifier and Type
  Method
  Description
  `char`
  `charAt(int index)`
  Returns the `byte` value at the specified index.
  `int`
  `getECIValue(int index)`
  Returns the `int` ECI value at the specified index.
  `int`
  `getFNC1Character()`
  `boolean`
  `haveNCharacters(int index, int n)`
  `boolean`
  `isECI(int index)`
  Determines if a value is an ECI
  `boolean`
  `isFNC1(int index)`
  Determines if a value is the FNC1 character
  `int`
  `length()`
  Returns the length of this input.
  `CharSequence`
  `subSequence(int start, int end)`
  Returns a `CharSequence` that is a subsequence of this sequence.
  `String`
  `toString()`

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

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

- ## Constructor Details

  - ### MinimalECIInput

    public MinimalECIInput(String stringToEncode, Charset priorityCharset, int fnc1)
    Constructs a minimal input
    Parameters:
      `stringToEncode` - the character string to encode
      `priorityCharset` - The preferred `Charset`. When the value of the argument is null, the algorithm chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority charset to encode any character in the input that can be encoded by it if the charset is among the supported charsets.
      `fnc1` - denotes the character in the input that represents the FNC1 character or -1 if this is not GS1 input.

- ## Method Details

  - ### getFNC1Character

    public int getFNC1Character()

  - ### length

    public int length()
    Returns the length of this input. The length is the number of `byte`s, FNC1 characters or ECIs in the sequence.
    Specified by:
      `length` in interface `ECIInput`
    Returns:
      the number of `char`s in this sequence

  - ### haveNCharacters

    public boolean haveNCharacters(int index, int n)
    Specified by:
      `haveNCharacters` in interface `ECIInput`

  - ### charAt

    public char charAt(int index)
    Returns the `byte` value at the specified index. An index ranges from zero to `length() - 1`. The first `byte` value of the sequence is at index zero, the next at index one, and so on, as for array indexing.
    Specified by:
      `charAt` in interface `ECIInput`
    Parameters:
      `index` - the index of the `byte` value to be returned
    Returns:
      the specified `byte` value as character or the FNC1 character
    Throws:
      `IndexOutOfBoundsException` - if the `index` argument is negative or not less than `length()`
      `IllegalArgumentException` - if the value at the `index` argument is an ECI (@see #isECI)

  - ### subSequence

    public CharSequence subSequence(int start, int end)
    Returns a `CharSequence` that is a subsequence of this sequence. The subsequence starts with the `char` value at the specified index and ends with the `char` value at index `end - 1`. The length (in `char`s) of the returned sequence is `end - start`, so if `start == end` then an empty sequence is returned.
    Specified by:
      `subSequence` in interface `ECIInput`
    Parameters:
      `start` - the start index, inclusive
      `end` - the end index, exclusive
    Returns:
      the specified subsequence
    Throws:
      `IndexOutOfBoundsException` - if `start` or `end` are negative, if `end` is greater than `length()`, or if `start` is greater than `end`
      `IllegalArgumentException` - if a value in the range `start`-`end` is an ECI (@see #isECI)

  - ### isECI

    public boolean isECI(int index)
    Determines if a value is an ECI
    Specified by:
      `isECI` in interface `ECIInput`
    Parameters:
      `index` - the index of the value
    Returns:
      true if the value at position `index` is an ECI
    Throws:
      `IndexOutOfBoundsException` - if the `index` argument is negative or not less than `length()`

  - ### isFNC1

    public boolean isFNC1(int index)
    Determines if a value is the FNC1 character
    Parameters:
      `index` - the index of the value
    Returns:
      true if the value at position `index` is the FNC1 character
    Throws:
      `IndexOutOfBoundsException` - if the `index` argument is negative or not less than `length()`

  - ### getECIValue

    public int getECIValue(int index)
    Returns the `int` ECI value at the specified index. An index ranges from zero to `length() - 1`. The first `byte` value of the sequence is at index zero, the next at index one, and so on, as for array indexing.
    Specified by:
      `getECIValue` in interface `ECIInput`
    Parameters:
      `index` - the index of the `int` value to be returned
    Returns:
      the specified `int` ECI value. The ECI specified the encoding of all bytes with a higher index until the next ECI or until the end of the input if no other ECI follows.
    Throws:
      `IndexOutOfBoundsException` - if the `index` argument is negative or not less than `length()`
      `IllegalArgumentException` - if the value at the `index` argument is not an ECI (@see #isECI)

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`