|
The following error may be caused by passing a byte array directly
into the DataToEncode method that expects a string value:
java.lang.ArrayIndexOutOfBoundsException
The solutions are different depending on the symbology:
-
PDF417: This is only possible with IDAutomation's PDF417 Java
Products V 4.10 dated October, 2004 or later. When using PDF417, pass the byte array to the binaryCode
field of the class library. Make sure to set the processTilde to false and
set PDFMode to 0.
For example:
PDF417 bc=new PDF417();
bc.processTilde=false;
bc.PDFMode=0;
bc.binaryCode=myByteArray;
Download a working example of this code here...
-
Data Matrix: When using Data Matrix, use the code example below to convert
the byte array
(encodedBytes) into a string that can be encoded in the code field.
Make sure to set the encoding to E_BASE256 and processTilde to false.
DataMatrix bc = new DataMatrix();
bc.encoding = DataMatrix.E_BASE256;
bc.processTilde=false;
bc.code="";
String binaryString;
for (int i=0; i < encodedBytes.length; i++)
{
binaryString = Integer.toBinaryString((int)encodedBytes[i]);
if (binaryString.length() > 8)
binaryString = binaryString.substring(binaryString.length()-8,binaryString.length());
bc.code = bc.code + (char) Integer.parseInt(binaryString,2);
}
Download a working example of this code here...
NOTE: a byte array should only be passed into
IDAutomation's Java Barcode Products that
can encode this information such as Data Matrix and PDF417.
|
Related Documents
and Keywords:
|
See also:
TSI
Copyright © 2004-2006, IDAutomation.com, Inc. All rights reserved. All trademarks
mentioned are the property of their respective owners.
|
Over 70% of Fortune
100 companies use IDAutomation's products to automate their businesses. |
|