com.power4j.kit.printing.escpos.cmd.Cut Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esc-pos Show documentation
Show all versions of esc-pos Show documentation
Java library for ESC/POS printing.
The newest version!
package com.power4j.kit.printing.escpos.cmd;
/**
* @author CJ ([email protected])
* @date 2020/10/31
* @since 1.0
*/
public class Cut {
public static final int MODE_PART = 0;
public static final int MODE_FULL = 1;
/**
* 切纸模式 0 半切 1 全切
*/
private int mode;
public static Cut parse(String mode) {
int val = Integer.parseInt(mode);
if (val != MODE_PART && val != MODE_FULL) {
throw new IllegalArgumentException("Invalid mode value : " + mode);
}
return new Cut(val);
}
public Cut(int mode) {
this.mode = mode;
}
public Cut() {
this(MODE_PART);
}
public int getMode() {
return mode;
}
public void setMode(int mode) {
this.mode = mode;
}
public boolean isFullMode() {
return mode == MODE_FULL;
}
}