Constructor and Description |
---|
MinimalECIInput(String stringToEncode,
Charset priorityCharset,
int fnc1)
Constructs a minimal input
|
Modifier and Type | Method and 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() |
public MinimalECIInput(String stringToEncode, Charset priorityCharset, int fnc1)
stringToEncode
- the character string to encodepriorityCharset
- 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.public int getFNC1Character()
public int length()
byte
s, FNC1 characters or ECIs in the sequence.public boolean haveNCharacters(int index, int n)
haveNCharacters
in interface ECIInput
public char charAt(int index)
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.charAt
in interface ECIInput
index
- the index of the byte
value to be returnedbyte
value as character or the FNC1 characterIndexOutOfBoundsException
- if the index
argument is negative or not less than
length()
IllegalArgumentException
- if the value at the index
argument is an ECI (@see #isECI)public CharSequence subSequence(int start, int end)
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.subSequence
in interface ECIInput
start
- the start index, inclusiveend
- the end index, exclusiveIndexOutOfBoundsException
- 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)public boolean isECI(int index)
isECI
in interface ECIInput
index
- the index of the valueindex
is an ECIIndexOutOfBoundsException
- if the index
argument is negative or not less than
length()
public boolean isFNC1(int index)
index
- the index of the valueindex
is the FNC1 characterIndexOutOfBoundsException
- if the index
argument is negative or not less than
length()
public int getECIValue(int index)
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.getECIValue
in interface ECIInput
index
- the index of the int
value to be returnedint
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.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)Copyright © 2007–2024. All rights reserved.