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

公開メンバ関数

 QRCode (Graphics2D g)
 QRCode (String filepath)
 QRCode ()
 QRCode (String imgFormat, boolean useStream)
String getStringEncoding () throws Exception
void setStringEncoding (String value) throws Exception
String getErrorCorrect ()
void setErrorCorrect (String value)
int getVersion ()
void setVersion (int value)
String getEncodeMode ()
void setEncodeMode (String value)
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 (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 draw (byte code[], float x, float y, float width, float height) 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 drawDelicate (byte code[], float x, float y, float minLinePitch) throws Exception
void drawDirect (String code, float x, float y, float width) throws Exception
void drawDirect (String code, float x, float y, float width, String filePath) throws Exception
void drawDirect (byte code[], float x, float y, float width) throws Exception
void WriteSVG (String code, float x, float y, float minLinePitch, String filePath) throws Exception
void WriteSVG (byte code[], 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

詳解

QRコードを生成する2次元バーコードライブラリです。 数字、英数字、漢字、かな、ひらがな、記号、バイナリ、制御コードなど、あらゆる種類のデータを扱えます。 1つのシンボルに最大7,089文字をエンコードできます。

エンコードモードごとの容量: 数字のみ 最大7,089文字 英数字 最大4,296文字 バイナリ(8ビット) 最大2,953バイト 漢字、全角かな 最大1,817文字

3つのエンコードモードをサポート: 数字、英数字、バイナリ8ビット

著者
PAO

構築子と解体子

◆ QRCode() [1/4]

pao.barcode.QRCode.QRCode ( Graphics2D g)

QRコードのインスタンスを作成します。

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

◆ QRCode() [2/4]

pao.barcode.QRCode.QRCode ( String filepath)

QRコードのインスタンスを作成します。

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

◆ QRCode() [3/4]

pao.barcode.QRCode.QRCode ( )

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

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

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

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

◆ QRCode() [4/4]

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

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

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

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

メソッド詳解

◆ draw() [1/3]

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

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

引数
codeバーコードとして生成するバイト配列
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
widthバーコードの幅
heightバーコードの高さ
例外
Exceptionnone

◆ draw() [2/3]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
widthバーコードの幅
heightバーコードの高さ
例外
Exceptionnone

◆ draw() [3/3]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
widthバーコードの幅
heightバーコードの高さ
filePath画像ファイルパス
例外
Exceptionnone

◆ drawDelicate() [1/3]

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

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

引数
codeバーコードとして生成するバイト配列
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
minLinePitchバーコードの最小ラインピッチ
例外
Exceptionnone

◆ drawDelicate() [2/3]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
minLinePitchバーコードの最小ラインピッチ
例外
Exceptionnone

◆ drawDelicate() [3/3]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
minLinePitchバーコードの最小ラインピッチ
filePath画像ファイルパス
例外
Exceptionnone

◆ drawDirect() [1/3]

void pao.barcode.QRCode.drawDirect ( byte code[],
float x,
float y,
float width ) throws Exception

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

引数
codeバーコードとして生成するバイト配列
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
widthバーコードの幅
例外
Exceptionnone

◆ drawDirect() [2/3]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
widthバーコードの幅
例外
Exceptionnone

◆ drawDirect() [3/3]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
widthバーコードの幅
filePath画像ファイルパス
例外
Exceptionnone

◆ getBackColor()

Color pao.barcode.QRCode.getBackColor ( )

背景色を取得します。

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

◆ getDrawDelicateWidth() [1/2]

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

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

引数
codeバーコードとして生成するバイト配列
minLinePitchバーコードの最小ラインピッチ
戻り値
drawDelicateの描画幅
例外
Exceptionnone

◆ getDrawDelicateWidth() [2/2]

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

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

引数
codeバーコードとして生成する文字列
minLinePitchバーコードの最小ラインピッチ
戻り値
drawDelicateの描画幅
例外
Exceptionnone

◆ getDrawDirectWidth() [1/2]

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

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

引数
codeバーコードとして生成するバイト配列
widthバーコードの幅
戻り値
drawDirectの描画幅
例外
Exceptionnone

◆ getDrawDirectWidth() [2/2]

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

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

引数
codeバーコードとして生成する文字列
widthバーコードの幅
戻り値
drawDirectの描画幅
例外
Exceptionnone

◆ getEncodeMode()

String pao.barcode.QRCode.getEncodeMode ( )

エンコードモードを取得します。

戻り値
エンコードモード ("A": 英数字、"N": 数字、その他: バイナリ8ビット)

◆ getErrorCorrect()

String pao.barcode.QRCode.getErrorCorrect ( )

エラー訂正レベルを取得します。

戻り値
エラー訂正レベル

◆ getForeColor()

Color pao.barcode.QRCode.getForeColor ( )

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

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

◆ getImageBase64()

String pao.barcode.QRCode.getImageBase64 ( )

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

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

◆ getImageFormat()

String pao.barcode.QRCode.getImageFormat ( )

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

戻り値
画像フォーマット

◆ getImageStream()

ByteArrayOutputStream pao.barcode.QRCode.getImageStream ( )

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

戻り値
画像ストリーム

◆ getImgMargin()

int pao.barcode.QRCode.getImgMargin ( )

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

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

◆ getRotateAngle()

float pao.barcode.QRCode.getRotateAngle ( )

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

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

◆ getStringEncoding()

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

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

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

◆ getVersion()

int pao.barcode.QRCode.getVersion ( )

バーコードバージョンを取得します。

戻り値
バーコードバージョン (1〜40)

◆ setBackColor()

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

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

引数
value背景色

◆ setEncodeMode()

void pao.barcode.QRCode.setEncodeMode ( String value)

エンコードモードを設定します。

引数
valueエンコードモード ("A": 英数字、"N": 数字、その他: バイナリ8ビット)

◆ setErrorCorrect()

void pao.barcode.QRCode.setErrorCorrect ( String value)

エラー訂正レベルを設定します。

引数
valueエラー訂正レベル ("L"/"Q"/"H"/その他) "L": 約7復元可能 "Q": 約25復元可能 "H": 約30復元可能 その他: 約15復元可能

◆ setForeColor()

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

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

引数
valueバーの色

◆ setImageFormat()

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

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

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

◆ setImageStream()

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

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

引数
value画像ストリーム

◆ setImgMargin()

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

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

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

◆ setStringEncoding()

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

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

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

◆ setVersion()

void pao.barcode.QRCode.setVersion ( int value)

バーコードバージョンを設定します。

引数
valueバーコードバージョン (1〜40、0で自動選択)

◆ WriteSVG() [1/2]

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

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

引数
codeバーコードとして生成するバイト配列
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
minLinePitchバーコードの最小ラインピッチ
filePathSVGファイルパス
例外
Exceptionnone

◆ WriteSVG() [2/2]

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

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

引数
codeバーコードとして生成するテキスト
xバーコードの位置 (X座標)
yバーコードの位置 (Y座標)
minLinePitchバーコードの最小ラインピッチ
filePathSVGファイルパス
例外
Exceptionnone

◆ writeSVGToString() [1/2]

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

SVG形式でバーコードを出力します。 pDrawDirectのロジックに準拠。

引数
codeバーコードとして生成するバイト配列
xX座標
yY座標
widthバーコードの幅
heightバーコードの高さ
戻り値
SVG文字列
例外
Exceptionリソースが見つからない場合

◆ writeSVGToString() [2/2]

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

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

引数
codeバーコードとして生成するテキスト
xX座標
yY座標
widthバーコードの幅
heightバーコードの高さ
戻り値
SVG文字列
例外
Exceptionリソースが見つからない場合

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