Package com.google.zxing.common
Class MinimalECIInput
java.lang.Object
com.google.zxing.common.MinimalECIInput
- All Implemented Interfaces:
- 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 SummaryConstructorsConstructorDescriptionMinimalECIInput(String stringToEncode, Charset priorityCharset, int fnc1) Constructs a minimal input
- 
Method SummaryModifier and TypeMethodDescriptioncharcharAt(int index) Returns thebytevalue at the specified index.intgetECIValue(int index) Returns theintECI value at the specified index.intbooleanhaveNCharacters(int index, int n) booleanisECI(int index) Determines if a value is an ECIbooleanisFNC1(int index) Determines if a value is the FNC1 characterintlength()Returns the length of this input.subSequence(int start, int end) Returns aCharSequencethat is a subsequence of this sequence.toString()
- 
Constructor Details- 
MinimalECIInputConstructs 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- 
getFNC1Characterpublic int getFNC1Character()
- 
lengthpublic int length()Returns the length of this input. The length is the number ofbytes, FNC1 characters or ECIs in the sequence.
- 
haveNCharacterspublic boolean haveNCharacters(int index, int n) - Specified by:
- haveNCharactersin interface- ECIInput
 
- 
charAtpublic char charAt(int index) Returns thebytevalue at the specified index. An index ranges from zero tolength() - 1. The firstbytevalue of the sequence is at index zero, the next at index one, and so on, as for array indexing.- Specified by:
- charAtin interface- ECIInput
- Parameters:
- index- the index of the- bytevalue to be returned
- Returns:
- the specified bytevalue as character or the FNC1 character
- Throws:
- IndexOutOfBoundsException- if the- indexargument is negative or not less than- length()
- IllegalArgumentException- if the value at the- indexargument is an ECI (@see #isECI)
 
- 
subSequenceReturns aCharSequencethat is a subsequence of this sequence. The subsequence starts with thecharvalue at the specified index and ends with thecharvalue at indexend - 1. The length (inchars) of the returned sequence isend - start, so ifstart == endthen an empty sequence is returned.- Specified by:
- subSequencein interface- ECIInput
- Parameters:
- start- the start index, inclusive
- end- the end index, exclusive
- Returns:
- the specified subsequence
- Throws:
- IndexOutOfBoundsException- if- startor- endare negative, if- endis greater than- length(), or if- startis greater than- end
- IllegalArgumentException- if a value in the range- start-- endis an ECI (@see #isECI)
 
- 
isECIpublic boolean isECI(int index) Determines if a value is an ECI- Specified by:
- isECIin interface- ECIInput
- Parameters:
- index- the index of the value
- Returns:
- true if the value at position indexis an ECI
- Throws:
- IndexOutOfBoundsException- if the- indexargument is negative or not less than- length()
 
- 
isFNC1public 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 indexis the FNC1 character
- Throws:
- IndexOutOfBoundsException- if the- indexargument is negative or not less than- length()
 
- 
getECIValuepublic int getECIValue(int index) Returns theintECI value at the specified index. An index ranges from zero tolength() - 1. The firstbytevalue of the sequence is at index zero, the next at index one, and so on, as for array indexing.- Specified by:
- getECIValuein interface- ECIInput
- Parameters:
- index- the index of the- intvalue to be returned
- Returns:
- the specified intECI 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- indexargument is negative or not less than- length()
- IllegalArgumentException- if the value at the- indexargument is not an ECI (@see #isECI)
 
- 
toString
 
-