Barcode.jar ver 5.0.0
Java 開発者向け バーコード作成ライブラリ(SVG出力・Base64出力対応)
読み取り中…
検索中…
一致する文字列を見つけられません
pao.barcode.DataMatrix クラス

公開メンバ関数

 DataMatrix (Graphics2D g)
 DataMatrix (String filepath)
 DataMatrix ()
 DataMatrix (String imgFormat, boolean useStream)
String getStringEncoding () throws Exception
void setStringEncoding (String value) throws Exception
DxCodeSize getCodeSize () throws Exception
void setCodeSize (DxCodeSize value) throws Exception
float getRotateAngle ()
int getImgMargin ()
void setImgMargin (int value)
ByteArrayOutputStream getImageStream ()
void setImageStream (ByteArrayOutputStream value)
String getImageBase64 ()
String getImageFormat ()
void setImageFormat (String value)
Color getForeColor ()
void setForeColor (Color value)
Color getBackColor ()
void setBackColor (Color value)
void draw (byte[] data, float x, float y, float width, float height) throws Exception
void draw (byte[] data, float x, float y, float width, float height, String imgFilePath) throws Exception
void draw (String code, float x, float y, float width, float height) throws Exception
void draw (String code, float x, float y, float width, float height, String filePath) throws Exception
void drawDelicate (byte[] data, float x, float y, float minLinePitch) throws Exception
void drawDelicate (byte[] data, float x, float y, float minLinePitch, String imgFilePath) throws Exception
void drawDelicate (String code, float x, float y, float minLinePitch) throws Exception
void drawDelicate (String code, float x, float y, float minLinePitch, String filePath) throws Exception
void drawDirect (byte[] data, float x, float y, float width, float height) throws Exception
void drawDirect (byte[] data, float x, float y, float width, float height, String imgFilePath) throws Exception
void drawDirect (String code, float x, float y, float width, float height) throws Exception
void drawDirect (String code, float x, float y, float width, float height, String filePath) throws Exception
void WriteSVG (String code, float x, float y, float minLinePitch, String filePath) throws Exception
void WriteSVG (byte data[], float x, float y, float minLinePitch, String filePath) throws Exception
float getDrawDelicateWidth (String code, float minLinePitch) throws Exception
float getDrawDelicateWidth (byte code[], float minLinePitch) throws Exception
float getDrawDirectWidth (String code, float width) throws Exception
float getDrawDirectWidth (byte code[], float width) throws Exception
String writeSVGToString (String code, float x, float y, float width, float height) throws Exception
String writeSVGToString (byte[] code, float x, float y, float width, float height) throws Exception

詳解

DataMatrixを生成する2次元バーコードライブラリです。数字、英数字、漢字、かな、ひらがな、記号、バイナリ、制御コードなど、あらゆる種類のデータを扱えます。

著者
PAO

構築子と解体子

◆ DataMatrix() [1/4]

pao.barcode.DataMatrix.DataMatrix ( Graphics2D g)

Byte Data DataMatrixのインスタンスを作成します。

引数
gバーコードを描画するGraphics2D

◆ DataMatrix() [2/4]

pao.barcode.DataMatrix.DataMatrix ( String filepath)

DataMatrixのインスタンスを作成します。

引数
filePath出力画像ファイルパス

◆ DataMatrix() [3/4]

pao.barcode.DataMatrix.DataMatrix ( )

DataMatrixのインスタンスを作成します。 画像形式はデフォルトでPNGが設定されます。

このコンストラクタは以下の用途で使用できます:

  • SVG出力(writeSVGToStringメソッド等)
  • Base64形式での画像データ取得(getImageBase64メソッド)
  • メモリストリームでの画像データ取得(getImageStreamメソッド)

Graphics2Dやファイルパスを指定せずに、シンプルにバーコードを生成できます。

◆ DataMatrix() [4/4]

pao.barcode.DataMatrix.DataMatrix ( String imgFormat,
boolean useStream )

DataMatrixのインスタンスを作成します(メモリストリーム出力用)。

このコンストラクタは、ファイルに保存せずにメモリ上で画像データを取得したい場合に使用します。 生成後、以下のメソッドで画像データを取得できます:

引数
imgFormat出力画像フォーマット("png", "jpeg", "bmp"など)。 nullや空文字、または無効な形式が指定された場合は"png"が使用されます。
useStreamストリーム出力を使用する場合はtrue。 falseの場合はストリーム機能は無効となり、getImageBase64等は空を返します。

メソッド詳解

◆ draw() [1/4]

void pao.barcode.DataMatrix.draw ( byte[] data,
float x,
float y,
float width,
float height ) throws Exception

バーコードを描画します。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定

◆ draw() [2/4]

void pao.barcode.DataMatrix.draw ( byte[] data,
float x,
float y,
float width,
float height,
String imgFilePath ) throws Exception

バーコードを描画します。 コンストラクタでImageFormat指定時、画像ファイルに描画する。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定
imgFilePath画像ファイルパス

◆ draw() [3/4]

void pao.barcode.DataMatrix.draw ( String code,
float x,
float y,
float width,
float height ) throws Exception

バーコードを描画します。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定

◆ draw() [4/4]

void pao.barcode.DataMatrix.draw ( String code,
float x,
float y,
float width,
float height,
String filePath ) throws Exception

バーコードを描画します。 コンストラクタでImageFormat指定時、画像ファイルに描画する。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定
imgFilePath画像ファイルパス

◆ drawDelicate() [1/4]

void pao.barcode.DataMatrix.drawDelicate ( byte[] data,
float x,
float y,
float minLinePitch ) throws Exception

最小ピッチを指定してバーコードを描画します。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
minLinePitchバーコードを描画する間隔の最小幅の値を指定

◆ drawDelicate() [2/4]

void pao.barcode.DataMatrix.drawDelicate ( byte[] data,
float x,
float y,
float minLinePitch,
String imgFilePath ) throws Exception

最小ピッチを指定してバーコードを描画します。 コンストラクタでImageFormat指定時、画像ファイルに描画する。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
minLinePitchバーコードを描画するバーの最小ピッチの値を指定
imgFilePath画像ファイルパス

◆ drawDelicate() [3/4]

void pao.barcode.DataMatrix.drawDelicate ( String code,
float x,
float y,
float minLinePitch ) throws Exception

最小ピッチを指定してバーコードを描画します。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
minLinePitchバーコードを描画する間隔の最小幅の値を指定

◆ drawDelicate() [4/4]

void pao.barcode.DataMatrix.drawDelicate ( String code,
float x,
float y,
float minLinePitch,
String filePath ) throws Exception

最小ピッチを指定してバーコードを描画します。 コンストラクタでImageFormat指定時、画像ファイルに描画する。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
minLinePitchバーコードを描画するバーの最小ピッチの値を指定
filePath画像ファイルパス

◆ drawDirect() [1/4]

void pao.barcode.DataMatrix.drawDirect ( byte[] data,
float x,
float y,
float width,
float height ) throws Exception

ピクセル単位で直接バーコードを描画します。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定

◆ drawDirect() [2/4]

void pao.barcode.DataMatrix.drawDirect ( byte[] data,
float x,
float y,
float width,
float height,
String imgFilePath ) throws Exception

ピクセル単位で直接バーコードを描画します。 コンストラクタでImageFormat指定時、画像ファイルに描画する。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定
imgFilePath画像ファイルパス

◆ drawDirect() [3/4]

void pao.barcode.DataMatrix.drawDirect ( String code,
float x,
float y,
float width,
float height ) throws Exception

ピクセル単位で直接バーコードを描画します。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定

◆ drawDirect() [4/4]

void pao.barcode.DataMatrix.drawDirect ( String code,
float x,
float y,
float width,
float height,
String filePath ) throws Exception

ピクセル単位で直接バーコードを描画します。 コンストラクタでImageFormat指定時、画像ファイルに描画する。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
widthバーコードの全体の幅を指定
heightバーコードのバーの高さを指定
filePath画像ファイルパス

◆ getBackColor()

Color pao.barcode.DataMatrix.getBackColor ( )

背景色を取得します。

戻り値
背景色(デフォルト: null = 透明)

◆ getCodeSize()

DxCodeSize pao.barcode.DataMatrix.getCodeSize ( ) throws Exception

シンボルコードサイズを取得します。

戻り値
シンボルコードサイズ

◆ getDrawDelicateWidth() [1/2]

float pao.barcode.DataMatrix.getDrawDelicateWidth ( byte code[],
float minLinePitch ) throws Exception

描画時のバーコード幅を取得します。

引数
codeバーコードに格納するデータのバイト配列
minLinePitchバーコードを描画する間隔の最小幅の値
戻り値
drawDelicateで描画した場合のバーコード幅
例外
Exception例外

◆ getDrawDelicateWidth() [2/2]

float pao.barcode.DataMatrix.getDrawDelicateWidth ( String code,
float minLinePitch ) throws Exception

描画時のバーコード幅を取得します。

引数
codeバーコードに格納するコード文字列
minLinePitchバーコードを描画する間隔の最小幅の値
戻り値
drawDelicateで描画した場合のバーコード幅
例外
Exception例外

◆ getDrawDirectWidth() [1/2]

float pao.barcode.DataMatrix.getDrawDirectWidth ( byte code[],
float width ) throws Exception

描画時のバーコード幅を取得します。

引数
codeバーコードに格納するデータのバイト配列
widthバーコードの全体の幅
戻り値
drawDirectで描画した場合のバーコード幅
例外
Exception例外

◆ getDrawDirectWidth() [2/2]

float pao.barcode.DataMatrix.getDrawDirectWidth ( String code,
float width ) throws Exception

描画時のバーコード幅を取得します。

引数
codeバーコードに格納するコード文字列
widthバーコードの全体の幅
戻り値
drawDirectで描画した場合のバーコード幅
例外
Exception例外

◆ getForeColor()

Color pao.barcode.DataMatrix.getForeColor ( )

バーの色(前景色)を取得します。

戻り値
バーの色(デフォルト: 黒)

◆ getImageBase64()

String pao.barcode.DataMatrix.getImageBase64 ( )

画像をBase64エンコードした文字列を取得します。

戻り値
Base64エンコードされた画像データ

◆ getImageFormat()

String pao.barcode.DataMatrix.getImageFormat ( )

画像フォーマットを取得します。

戻り値
画像フォーマット

◆ getImageStream()

ByteArrayOutputStream pao.barcode.DataMatrix.getImageStream ( )

画像ストリームを取得します。

戻り値
画像ストリーム

◆ getImgMargin()

int pao.barcode.DataMatrix.getImgMargin ( )

画像マージンのピクセル数を取得します。

戻り値
画像マージンのピクセル数

◆ getRotateAngle()

float pao.barcode.DataMatrix.getRotateAngle ( )

バーコードの回転角度を取得します。

戻り値
バーコードの回転角度

◆ getStringEncoding()

String pao.barcode.DataMatrix.getStringEncoding ( ) throws Exception

文字エンコーディングを取得します。

戻り値
文字エンコーディング

◆ setBackColor()

void pao.barcode.DataMatrix.setBackColor ( Color value)

背景色を設定します。 画像データ保存時のみ有効です。nullを指定すると透明になります。

引数
value背景色

◆ setCodeSize()

void pao.barcode.DataMatrix.setCodeSize ( DxCodeSize value) throws Exception

シンボルコードサイズを設定します。

引数
valueシンボルコードサイズ

◆ setForeColor()

void pao.barcode.DataMatrix.setForeColor ( Color value)

バーの色(前景色)を設定します。

引数
valueバーの色

◆ setImageFormat()

void pao.barcode.DataMatrix.setImageFormat ( String value)

画像フォーマットを設定します。

引数
value画像フォーマット ("png", "jpeg", "bmp"など)

◆ setImageStream()

void pao.barcode.DataMatrix.setImageStream ( ByteArrayOutputStream value)

画像ストリームを設定します。

引数
value画像ストリーム

◆ setImgMargin()

void pao.barcode.DataMatrix.setImgMargin ( int value)

画像マージンのピクセル数を設定します。

引数
value画像マージンのピクセル数

◆ setStringEncoding()

void pao.barcode.DataMatrix.setStringEncoding ( String value) throws Exception

文字エンコーディングを設定します。

引数
value文字エンコーディング

◆ WriteSVG() [1/2]

void pao.barcode.DataMatrix.WriteSVG ( byte data[],
float x,
float y,
float minLinePitch,
String filePath ) throws Exception

SVG形式でバーコードを出力します。

引数
dataバーコードに格納するデータをバイト配列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
minLinePitchバーコードを描画する間隔の最小幅の値を指定
filePathSVGファイルのファイル名をフルパスで指定

◆ WriteSVG() [2/2]

void pao.barcode.DataMatrix.WriteSVG ( String code,
float x,
float y,
float minLinePitch,
String filePath ) throws Exception

SVG形式でバーコードを出力します。

引数
code描画を行うバーコードのコードを文字列で指定
x描画位置の始点(左上)のX座標を指定
y描画位置の始点(左上)のY座標を指定
minLinePitchバーコードを描画する間隔の最小幅の値を指定
filePathSVGファイルのファイル名をフルパスで指定

◆ writeSVGToString() [1/2]

String pao.barcode.DataMatrix.writeSVGToString ( byte[] code,
float x,
float y,
float width,
float height ) throws Exception

SVG形式でバーコードを出力します。

引数
codeバーコードに格納するデータのバイト配列
x描画位置の始点(左上)のX座標
y描画位置の始点(左上)のY座標
widthバーコードの全体の幅
heightバーコードの高さ
戻り値
SVG文字列
例外
Exception例外

◆ writeSVGToString() [2/2]

String pao.barcode.DataMatrix.writeSVGToString ( String code,
float x,
float y,
float width,
float height ) throws Exception

SVG形式でバーコードを出力します。

引数
codeバーコードに格納するコード文字列
x描画位置の始点(左上)のX座標
y描画位置の始点(左上)のY座標
widthバーコードの全体の幅
heightバーコードの高さ
戻り値
SVG文字列
例外
Exception例外

このクラス詳解は次のファイルから抽出されました: