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

公開メンバ関数

 YubinCustomer (Graphics2D g)
 YubinCustomer (String filepath)
 YubinCustomer ()
 YubinCustomer (String imgFormat, boolean useStream)
float getRotateAngle ()
void setRotateAngle (float value)
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) throws ErrYubinBadChar
void draw (String code, float x, float y) throws ErrYubinBadChar
void draw (String code, float x, float y, float height) throws ErrYubinBadChar
void draw (String code, float x, float y, float height, String filePath) throws ErrYubinBadChar
float getDrawWidth (String code, float height) throws ErrYubinBadChar
String writeSVGToString (String code, float x, float y, float height)
String writeSVGToString (String code, float x, float y, float height, float unused)

詳解

郵便カスタマーバーコードを生成するためのバーコードライブラリクラスです。

4ステート3バー方式のバーコードで、郵便番号と住所表示番号をエンコードする。 バーの種類:

  • ロングバー: 上下両方に伸びる("1")
  • セミロング上: 上方向のみに伸びる("2")
  • セミロング下: 下方向のみに伸びる("3")
  • タイミングバー: 中央の短いバー("4")

寸法比率(日本郵便仕様): ロングバー : タイミングバー : バー幅 : バーピッチ = 6 : 2 : 1 : 2

著者
PAO

構築子と解体子

◆ YubinCustomer() [1/4]

pao.barcode.YubinCustomer.YubinCustomer ( Graphics2D g)

郵便カスタマーバーコードのインスタンスを作成します。

引数
gバーコードを描画するGraphics2Dオブジェクト

◆ YubinCustomer() [2/4]

pao.barcode.YubinCustomer.YubinCustomer ( String filepath)

郵便カスタマーバーコードのインスタンスを作成します。

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

◆ YubinCustomer() [3/4]

pao.barcode.YubinCustomer.YubinCustomer ( )

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

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

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

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

◆ YubinCustomer() [4/4]

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

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

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

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

メソッド詳解

◆ draw() [1/4]

void pao.barcode.YubinCustomer.draw ( String code) throws ErrYubinBadChar

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

引数
codeバーコードとして生成するテキスト
例外
ErrYubinBadChar不正な文字が含まれている場合

◆ draw() [2/4]

void pao.barcode.YubinCustomer.draw ( String code,
float x,
float y ) throws ErrYubinBadChar

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

引数
codeバーコードとして生成するテキスト
xバーコードのX座標
yバーコードのY座標
例外
ErrYubinBadChar不正な文字が含まれている場合

◆ draw() [3/4]

void pao.barcode.YubinCustomer.draw ( String code,
float x,
float y,
float height ) throws ErrYubinBadChar

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

引数
codeバーコードとして生成するテキスト
xバーコードのX座標
yバーコードのY座標
heightバーコードの高さ(ロングバーの長さ、ピクセル単位)
例外
ErrYubinBadChar不正な文字が含まれている場合

heightを基準に全ての寸法が決まる:

  • ロングバー長さ = height
  • タイミングバー長さ = height / 3
  • バー幅 = height / 6
  • バーピッチ = height / 3

◆ draw() [4/4]

void pao.barcode.YubinCustomer.draw ( String code,
float x,
float y,
float height,
String filePath ) throws ErrYubinBadChar

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

引数
codeバーコードとして生成するテキスト
xバーコードのX座標
yバーコードのY座標
heightバーコードの高さ(ロングバーの長さ、ピクセル単位)
filePath出力画像ファイルパス
例外
ErrYubinBadChar不正な文字が含まれている場合

◆ getBackColor()

Color pao.barcode.YubinCustomer.getBackColor ( )

背景色を取得します。

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

◆ getDrawWidth()

float pao.barcode.YubinCustomer.getDrawWidth ( String code,
float height ) throws ErrYubinBadChar

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

引数
codeバーコードとして生成するテキスト
heightバーコードの高さ(ピクセル単位)
例外
ErrYubinBadChar不正な文字が含まれている場合

◆ getForeColor()

Color pao.barcode.YubinCustomer.getForeColor ( )

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

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

◆ getImageBase64()

String pao.barcode.YubinCustomer.getImageBase64 ( )

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

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

◆ getImageFormat()

String pao.barcode.YubinCustomer.getImageFormat ( )

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

戻り値
画像フォーマット

◆ getImageStream()

ByteArrayOutputStream pao.barcode.YubinCustomer.getImageStream ( )

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

戻り値
画像ストリーム

◆ getImgMargin()

int pao.barcode.YubinCustomer.getImgMargin ( )

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

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

◆ getRotateAngle()

float pao.barcode.YubinCustomer.getRotateAngle ( )

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

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

◆ setBackColor()

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

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

引数
value背景色

◆ setForeColor()

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

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

引数
valueバーの色

◆ setImageFormat()

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

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

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

◆ setImageStream()

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

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

引数
value画像ストリーム

◆ setImgMargin()

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

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

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

◆ setRotateAngle()

void pao.barcode.YubinCustomer.setRotateAngle ( float value)

バーコードの回転角度を設定します。

引数
valueバーコードの回転角度

◆ writeSVGToString() [1/2]

String pao.barcode.YubinCustomer.writeSVGToString ( String code,
float x,
float y,
float height )

バーコードをSVG文字列として生成します。

引数
codeバーコードとして生成するテキスト
xX座標
yY座標
heightバーコードの高さ(ロングバーの長さ、ピクセル単位)
戻り値
SVG文字列

heightを基準に全ての寸法が決まる:

  • ロングバー長さ = height
  • タイミングバー長さ = height / 3
  • バー幅 = height / 6
  • バーピッチ = height / 3

◆ writeSVGToString() [2/2]

String pao.barcode.YubinCustomer.writeSVGToString ( String code,
float x,
float y,
float height,
float unused )

バーコードをSVG文字列として生成します。 ※このオーバーロードでは第4引数を height として使用します。

引数
codeバーコードとして生成するテキスト
xX座標
yY座標
heightバーコードの高さ(ピクセル単位)
unused未使用(互換性のため)
戻り値
SVG文字列

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