com.java4less.j4ldatamatrix
Class DataMatrix

java.lang.Object
  extended by com.java4less.j4ldatamatrix.DataMatrix

public class DataMatrix
extends java.lang.Object

The class DataMatrix that creates data matrix barcode symbols. Data Matrix is a two-dimensional (2D) matrix symbology which is made up of square modules arranged within a perimeter finder pattern. It can encode up to 3116 characters from the entire 256 byte ASCII character set and it supports advanced encoding error checking and correction algorithms (reed-solomon). This algorithms allow the recognition of barcodes that are up to 60% damaged.

The following example illustrates how to create a bar code:

DataMatrix cb=new DataMatrix();
cb.encoding=cb.E_AUTO; // set type of encoding
cb.code="This is a test";


You can paint the barcode using the DatamatrixCanvas object or call the paint()
method which returns the barcode as an array of integers.


Field Summary
static int C104X104
           
static int C10X10
          C10x10 to C144x144 are the possible formats of the barcode (see Data Matrix Manual for more information about formats).
static int C120X120
           
static int C12X12
           
static int C12X26
           
static int C12X36
           
static int C132X132
           
static int C144X144
           
static int C14X14
           
static int C16X16
           
static int C16X36
           
static int C16X48
           
static int C18X18
           
static int C20X20
           
static int C22X22
           
static int C24X24
           
static int C26X26
           
static int C32X32
           
static int C36X36
           
static int C40X40
           
static int C44X44
           
static int C48X48
           
static int C52X52
           
static int C64X64
           
static int C72X72
           
static int C80X80
           
static int C88X88
           
static int C8X18
           
static int C8X32
           
static int C96X96
           
 java.lang.String code
          text to be encoded as barcode.
 byte[] codeBinary
          bytes for binary encoding
static int E_ASCII
          ascii encoding (see Data Matrix Manual for more information ).
static int E_AUTO
          automatic encoding.
static int E_BASE256
          base 256 encoding.
static int E_C40
          c40 encoding (see Data Matrix Manual for more information ).
static int E_NONE
           
static int E_TEXT
          text encoding (see Data Matrix Manual for more information ).
 int encoding
          selects the encoding you want to use: E_AUTO, E_ASCII (default), E_C40, E_TEXT or E_BASE256.
 int preferredFormat
          if -1 (default) , the class wil automatically select the format of the symbol.
 boolean processTilde
          if true (default is false) the class will process the ~ character in the input data (see help file for more information ).
 boolean reBuild
          set this field to true if you want to redraw the symbol.
 
Constructor Summary
DataMatrix()
           
 
Method Summary
 int getCalculatedFormat()
           
 int[][] paint()
          creates the barcode and return an array where each element is a dot in the matrix.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code

public java.lang.String code
text to be encoded as barcode.


processTilde

public boolean processTilde
if true (default is false) the class will process the ~ character in the input data (see help file for more information ).


reBuild

public boolean reBuild
set this field to true if you want to redraw the symbol.


codeBinary

public byte[] codeBinary
bytes for binary encoding


C10X10

public static final int C10X10
C10x10 to C144x144 are the possible formats of the barcode (see Data Matrix Manual for more information about formats). C104 x C104 means that the size of the symbol will be 104 x104 square modules.

See Also:
Constant Field Values

C12X12

public static final int C12X12
See Also:
Constant Field Values

C14X14

public static final int C14X14
See Also:
Constant Field Values

C16X16

public static final int C16X16
See Also:
Constant Field Values

C18X18

public static final int C18X18
See Also:
Constant Field Values

C20X20

public static final int C20X20
See Also:
Constant Field Values

C22X22

public static final int C22X22
See Also:
Constant Field Values

C24X24

public static final int C24X24
See Also:
Constant Field Values

C26X26

public static final int C26X26
See Also:
Constant Field Values

C32X32

public static final int C32X32
See Also:
Constant Field Values

C36X36

public static final int C36X36
See Also:
Constant Field Values

C40X40

public static final int C40X40
See Also:
Constant Field Values

C44X44

public static final int C44X44
See Also:
Constant Field Values

C48X48

public static final int C48X48
See Also:
Constant Field Values

C52X52

public static final int C52X52
See Also:
Constant Field Values

C64X64

public static final int C64X64
See Also:
Constant Field Values

C72X72

public static final int C72X72
See Also:
Constant Field Values

C80X80

public static final int C80X80
See Also:
Constant Field Values

C88X88

public static final int C88X88
See Also:
Constant Field Values

C96X96

public static final int C96X96
See Also:
Constant Field Values

C104X104

public static final int C104X104
See Also:
Constant Field Values

C120X120

public static final int C120X120
See Also:
Constant Field Values

C132X132

public static final int C132X132
See Also:
Constant Field Values

C144X144

public static final int C144X144
See Also:
Constant Field Values

C8X18

public static final int C8X18
See Also:
Constant Field Values

C8X32

public static final int C8X32
See Also:
Constant Field Values

C12X26

public static final int C12X26
See Also:
Constant Field Values

C12X36

public static final int C12X36
See Also:
Constant Field Values

C16X36

public static final int C16X36
See Also:
Constant Field Values

C16X48

public static final int C16X48
See Also:
Constant Field Values

encoding

public int encoding
selects the encoding you want to use: E_AUTO, E_ASCII (default), E_C40, E_TEXT or E_BASE256.


E_ASCII

public static int E_ASCII
ascii encoding (see Data Matrix Manual for more information ). This is appropiate for data that contains mainly ascii characters (1-127).


E_C40

public static int E_C40
c40 encoding (see Data Matrix Manual for more information ). This is appropiate for data that contains mainly upper case characters and digits.


E_TEXT

public static int E_TEXT
text encoding (see Data Matrix Manual for more information ). This is appropiate for data that contains mainly lower case characters and digits.


E_BASE256

public static int E_BASE256
base 256 encoding. This is mainly used for binary data.


E_NONE

public static int E_NONE

E_AUTO

public static int E_AUTO
automatic encoding. The class decides dinamically which encoding is more apporpiate for the data you want to encode.


preferredFormat

public int preferredFormat
if -1 (default) , the class wil automatically select the format of the symbol. Otherwise you must specify a value (C10X10 till C144X144).

Constructor Detail

DataMatrix

public DataMatrix()
Method Detail

getCalculatedFormat

public int getCalculatedFormat()

paint

public int[][] paint()
creates the barcode and return an array where each element is a dot in the matrix. Values equals to 0 are white dots, values <> 0 are black dots.