⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 barcodefactory.java

📁 这是个国外JAVA爱好者写的条形码生成器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createEAN13(String data) throws BarcodeException {
        return new EAN13Barcode(data);
    }

    /**
     * Creates a Bookland barcode, which is based on the EAN 13 Symbology.
     * For example, if you createBookland("968-26-1240-3") you will receive
     * an EAN 13 barcode of 9789682612404.
     * Note that only the '-' character will be automaticaly removed from the
     * ISBN data.
     *
     * @param isbn The ISBN of the book to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createBookland(String isbn) throws BarcodeException {
        return new BooklandBarcode(isbn);
    }

    /**
     * Creates a barcode based on the UPC-A Symbology.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createUPCA(String data) throws BarcodeException {
        return new UPCABarcode(data);
    }

    /**
     * Creates a barcode based on the UPC-A Symbology signifying a random weight.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createRandomWeightUPCA(String data) throws BarcodeException {
        return new UPCABarcode(data, true);
    }

    /**
     * Creates a barcode based on the Standard 2 of 5 Symbology.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     * @see #createStd2of5(String, boolean)
     */
    public static Barcode createStd2of5(String data) throws BarcodeException {
        return new Std2of5Barcode(data);
    }

    /**
     * Creates a barcode based on the Standard 2 of 5 Symbology.
     *
     * @param data       The data to encode
     * @param checkDigit if true then a check digit is appended automatically
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     * @see #createStd2of5(String)
     */
    public static Barcode createStd2of5(String data, boolean checkDigit) throws BarcodeException {
        return new Std2of5Barcode(data, checkDigit);
    }

    /**
     * Creates a barcode based on the Interleave 2 of 5 Symbology.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     * @see #createInt2of5(String, boolean)
     */
    public static Barcode createInt2of5(String data) throws BarcodeException {
        return new Int2of5Barcode(data);
    }

    /**
     * Creates a barcode based on the Interleave 2 of 5 Symbology.
     *
     * @param data       The data to encode
     * @param checkDigit if true then a check digit is appended automatically
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     * @see #createInt2of5(String)
     */
    public static Barcode createInt2of5(String data, boolean checkDigit) throws BarcodeException {
        return new Int2of5Barcode(data, checkDigit);
    }

    /**
     * Creates a PDF417 two dimensional barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createPDF417(String data) throws BarcodeException {
        return new PDF417Barcode(data);
    }

    /**
     * Creates a Code 39 linear barcode.
     *
     * @param data             The data to encode
     * @param requiresChecksum True if a check digit is required, false if not
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createCode39(String data, boolean requiresChecksum) throws BarcodeException {
        return new Code39Barcode(data, requiresChecksum);
    }

    /**
     * Creates a Code 3 of 9 (Code 39) linear barcode.
     *
     * @param data             The data to encode
     * @param requiresChecksum True if a check digit is required, false if not
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode create3of9(String data, boolean requiresChecksum) throws BarcodeException {
        return new Code39Barcode(data, requiresChecksum);
    }

    /**
     * Creates a USD3 (Code 39) linear barcode.
     *
     * @param data             The data to encode
     * @param requiresChecksum True if a check digit is required, false if not
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createUSD3(String data, boolean requiresChecksum) throws BarcodeException {
        return new Code39Barcode(data, requiresChecksum);
    }

    /**
     * Creates a Codabar linear barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createCodabar(String data) throws BarcodeException {
        return new CodabarBarcode(data);
    }

    /**
     * Creates a USD-4 (Codabar) linear barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createUSD4(String data) throws BarcodeException {
        return new CodabarBarcode(data);
    }

    /**
     * Creates a NW-7 (Codabar) linear barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createNW7(String data) throws BarcodeException {
        return new CodabarBarcode(data);
    }

    /**
     * Creates a Monarch (Codabar) linear barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode createMonarch(String data) throws BarcodeException {
        return new CodabarBarcode(data);
    }

    /**
     * Creates a 2 of 7 (Codabar) linear barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     */
    public static Barcode create2of7(String data) throws BarcodeException {
        return new CodabarBarcode(data);
    }

    /**
     * Creates a <a href="http://en.wikipedia.org/wiki/POSTNET">PostNet</a> linear barcode.
     *
     * @param data The data to encode
     * @return The barcode
     * @throws BarcodeException If the data to be encoded is invalid
     * 
     * 
     * 
     */
    public static Barcode createPostNet(String data) throws BarcodeException {
        return new PostNetBarcode(data);
    }
}

///CLOVER:ON

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -