欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Java zxing生成條形碼和二維嗎代碼實例

 更新時間:2020年03月04日 13:21:17   作者:畢永飛  
這篇文章主要介紹了java zxing生成條形碼和二維嗎代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友可以參考下

在如今的生活中,二維碼隨處可見,二維碼的出現(xiàn)既減少了宣傳紙張的浪費,又方便了人們的生活。這一篇我來說說 Java 利用第三方 Jar 包 zxing 生成二維碼。

依賴

<dependency>
  <groupId>com.google.zxing</groupId>
  <artifactId>core</artifactId>
  <version>3.3.3</version>
</dependency>
<dependency>
  <groupId>com.google.zxing</groupId>
  <artifactId>javase</artifactId>
  <version>3.3.3</version>
</dependency>

生成二維碼

package code;

import com.google.zxing.*;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Base64OutputStream;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.HashMap;
import java.util.Map;

public class QRCodeKit {

  public static final String QRCODE_DEFAULT_CHARSET = "UTF-8";

  public static final int QRCODE_DEFAULT_HEIGHT = 300;

  public static final int QRCODE_DEFAULT_WIDTH = 300;

  private static final int BLACK = 0xFF000000;
  private static final int WHITE = 0xFFFFFFFF;

  public static void main(String[] args) throws IOException, NotFoundException {
    String data = "https://www.jianshu.com/p/748aa03cc1e8?ddd=dsdsdsdsddsdsdsdsdsdsdsdsd";
    File logoFile = new File("C:/1.png");
    BufferedImage image = QRCodeKit.createQRCodeWithLogo(data, logoFile);
    ImageIO.write(image, "png", new File("D:/result7.png"));
    System.out.println("done");
  }

  /**
   * Create qrcode with default settings
   *
   * @param data
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCode(String data) {
    return createQRCode(data, QRCODE_DEFAULT_WIDTH, QRCODE_DEFAULT_HEIGHT);
  }

  /**
   * Create qrcode with default charset
   *
   * @param data
   * @param width
   * @param height
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCode(String data, int width, int height) {
    return createQRCode(data, QRCODE_DEFAULT_CHARSET, width, height);
  }

  /**
   * Create qrcode with specified charset
   *
   * @param data
   * @param charset
   * @param width
   * @param height
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCode(String data, String charset, int width, int height) {
    Map hint = new HashMap();
    hint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
    hint.put(EncodeHintType.CHARACTER_SET, charset);

    return createQRCode(data, charset, hint, width, height);
  }

  /**
   * Create qrcode with specified hint
   *
   * @param data
   * @param charset
   * @param hint
   * @param width
   * @param height
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCode(String data, String charset, Map<EncodeHintType, ?> hint, int width,
                       int height) {
    BitMatrix matrix;
    try {
      matrix = new MultiFormatWriter().encode(new String(data.getBytes(charset), charset), BarcodeFormat.QR_CODE,
          width, height, hint);
      return toBufferedImage(matrix);
    } catch (WriterException e) {
      throw new RuntimeException(e.getMessage(), e);
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }

  /**
   * toBufferedImage
   *
   * @param matrix
   * @return
   */
  public static BufferedImage toBufferedImage(BitMatrix matrix) {
    int width = matrix.getWidth();
    int height = matrix.getHeight();
    BufferedImage image = new BufferedImage(width, height,
        BufferedImage.TYPE_INT_RGB);
    for (int x = 0; x < width; x++) {
      for (int y = 0; y < height; y++) {
        image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
      }
    }
    return image;
  }

  /**
   * Create qrcode with default settings and logo
   *
   * @param data
   * @param logoFile
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCodeWithLogo(String data, File logoFile) {
    return createQRCodeWithLogo(data, QRCODE_DEFAULT_WIDTH, QRCODE_DEFAULT_HEIGHT, logoFile);
  }

  /**
   * Create qrcode with default charset and logo
   *
   * @param data
   * @param width
   * @param height
   * @param logoFile
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCodeWithLogo(String data, int width, int height, File logoFile) {
    return createQRCodeWithLogo(data, QRCODE_DEFAULT_CHARSET, width, height, logoFile);
  }

  /**
   * Create qrcode with specified charset and logo
   *
   * @param data
   * @param charset
   * @param width
   * @param height
   * @param logoFile
   * @return
   * @author stefli
   */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public static BufferedImage createQRCodeWithLogo(String data, String charset, int width, int height, File logoFile) {
    Map hint = new HashMap();
    hint.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
    hint.put(EncodeHintType.CHARACTER_SET, charset);
    hint.put(EncodeHintType.MARGIN, 2);

    return createQRCodeWithLogo(data, charset, hint, width, height, logoFile);
  }

  /**
   * Create qrcode with specified hint and logo
   *
   * @param data
   * @param charset
   * @param hint
   * @param width
   * @param height
   * @param logoFile
   * @return
   * @author stefli
   */
  public static BufferedImage createQRCodeWithLogo(String data, String charset, Map<EncodeHintType, ?> hint,
                           int width, int height, File logoFile) {
    try {
      BufferedImage qrcode = createQRCode(data, charset, hint, width, height);
      BufferedImage logo = ImageIO.read(logoFile);

      BufferedImage combined = new BufferedImage(height, width, BufferedImage.TYPE_INT_ARGB);
      Graphics2D g = (Graphics2D) combined.getGraphics();


      //設(shè)置二維碼大小,太大,會覆蓋二維碼,此處20%
      int logoWidth = logo.getWidth() > qrcode.getWidth() * 2 / 10 ? (qrcode.getWidth() * 2 / 10) : logo.getWidth();
      int logoHeight = logo.getHeight() > qrcode.getHeight() * 2 / 10 ? (qrcode.getHeight() * 2 / 10) : logo.getHeight();

      //設(shè)置logo圖片放置位置--中心
      int x = Math.round((qrcode.getWidth() - logoWidth) / 2);
      int y = Math.round((qrcode.getHeight() - logoHeight) / 2);

      g.drawImage(qrcode, 0, 0, null);
      g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));

      //開始合并繪制圖片
      g.drawImage(logo, x, y, logoWidth, logoHeight, null);
      g.drawRoundRect(x, y, logoWidth, logoHeight, 15, 15);

      //logo邊框大小
      g.setStroke(new BasicStroke(3));
      //logo邊框顏色
      g.setColor(Color.white);
      g.drawRoundRect(x, y, logoWidth, logoHeight, 15, 15);
      g.dispose();

      logo.flush();
      qrcode.flush();

      return combined;
    } catch (IOException e) {
      throw new RuntimeException(e.getMessage(), e);
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }

  /**
   * Return base64 for image
   *
   * @param image
   * @return
   * @author stefli
   */
  public static String getImageBase64String(BufferedImage image) {
    String result = null;
    try {
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      OutputStream b64 = new Base64OutputStream(os);
      ImageIO.write(image, "png", b64);
      result = os.toString("UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e.getMessage(), e);
    } catch (IOException e) {
      throw new RuntimeException(e.getMessage(), e);
    }
    return result;
  }

  /**
   * Decode the base64Image data to image
   *
   * @param base64ImageString
   * @param file
   * @author stefli
   */
  public static void convertBase64StringToImage(String base64ImageString, File file) {
    FileOutputStream os;
    try {
      Base64 d = new Base64();
      byte[] bs = d.decode(base64ImageString);
      os = new FileOutputStream(file.getAbsolutePath());
      os.write(bs);
      os.close();
    } catch (FileNotFoundException e) {
      throw new RuntimeException(e.getMessage(), e);
    } catch (IOException e) {
      throw new RuntimeException(e.getMessage(), e);
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }
}
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
import javax.imageio.ImageIO;
 
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
 
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.EncodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.Result;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.client.j2se.MatrixToImageConfig;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
 
/**
 * ZXing二維碼生成/解碼
 */
public class ZXingCode {
 
  public static void main(String[] args) throws WriterException {
    try {
      String logoPath = "F:/logo.jpg";
      String logo_savePath = "F:/" + new Date().getTime() + ".png";
      String str = toQRCode("http://blog.csdn.net/phil_jing", logoPath, logo_savePath, "CSDN博客");
      System.out.println("finished zxing QRcode encode.");
      System.out.println(Arrays.toString(Base64.decodeBase64(str)));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  
  /**
   * 生成二維碼圖片
   * @param content
   * @param logoPath
   * @param savePath
   * @param remark
   * @return
   */
  public static String toQRCode(String content, String logoPath, String savePath, String remark) {
    int width = 400, height = 400;
    try {
      BufferedImage bim = toBufferedImage(content, BarcodeFormat.QR_CODE, width, height, toDecodeHintType());
      return encode(bim, logoPath, savePath, new LogoConfig(), remark);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
 
  /**
   * 是否需要給二維碼圖片添加Logo
   * @param bim
   * @param logoPath
   * @param savePath
   * @param logoConfig
   * @param remark
   * @return
   */
  private static String encode(BufferedImage bim, String logoPath, String savePath, LogoConfig logoConfig, String remark) {
    ByteArrayOutputStream baos = null;
    try {
      /**
       * 讀取二維碼圖片
       */
      BufferedImage image = bim;
      if(StringUtils.isBlank(logoPath)){ //不需要添加logo
        baos = new ByteArrayOutputStream();
        baos.flush();
        ImageIO.write(image, "png", baos);//流輸出
        //ImageIO.write(bim, "png", new File(savePath));//直接寫入某路徑,本地測試加上
        return Base64.encodeBase64URLSafeString(baos.toByteArray());//Encodes binary data using a URL-safe variation of the base64 algorithm
      }
      /**
       * 構(gòu)建繪圖對象
       */
      Graphics2D g = image.createGraphics();
      /**
       * 讀取Logo圖片
       */
      BufferedImage logo = ImageIO.read(new File(logoPath));
      /**
       * 設(shè)置logo的大小,設(shè)置為二維碼圖片的20%,因為過大會蓋掉二維碼
       */
      int widthLogo = logo.getWidth(null) > image.getWidth() * 3 / 10 ? (image.getWidth() * 3 / 10)
          : logo.getWidth(null),
          heightLogo = logo.getHeight(null) > image.getHeight() * 3 / 10 ? (image.getHeight() * 3 / 10)
              : logo.getWidth(null);
      /**
       * logo放在中心
       */
      int x = (image.getWidth() - widthLogo) / 2;
      int y = (image.getHeight() - heightLogo) / 2;
      /**
       * logo放在右下角 int x = (image.getWidth() - widthLogo); int y = (image.getHeight() - heightLogo);
       */
      // 開始繪制圖片
      g.drawImage(logo, x, y, widthLogo, heightLogo, null);
      // g.drawRoundRect(x, y, widthLogo, heightLogo, 15, 15);
      // g.setStroke(new BasicStroke(logoConfig.getBorder()));
      // g.setColor(logoConfig.getBorderColor());
      // g.drawRect(x, y, widthLogo, heightLogo);
      g.dispose();
      // 把備注添加上去,備注不要太長超過兩行會自動截取
      if ( StringUtils.isNotBlank(remark)){
        // 新的圖片,把帶logo的二維碼下面加上文字
        BufferedImage outImage = new BufferedImage(400, 445, BufferedImage.TYPE_4BYTE_ABGR);
        Graphics2D outg = outImage.createGraphics();
        // 畫二維碼到新的面板
        outg.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null);
        // 畫文字到新的面板
        outg.setColor(Color.BLACK);
        outg.setFont(new Font("微軟雅黑", Font.BOLD, 30)); // 字體、字型、字號
        int strWidth = outg.getFontMetrics().stringWidth(remark);
        if (strWidth > 399) {
          // //長度過長就截取前面部分
          // outg.drawString(productName, 0, image.getHeight() +
          // (outImage.getHeight() - image.getHeight())/2 + 5 ); //畫文字
          String productName1 = remark.substring(0, remark.length() / 2);
          String productName2 = remark.substring(remark.length() / 2, remark.length());
          int strWidth1 = outg.getFontMetrics().stringWidth(productName1);
          int strWidth2 = outg.getFontMetrics().stringWidth(productName2);
          outg.drawString(productName1, 200 - strWidth1 / 2, image.getHeight() + (outImage.getHeight() - image.getHeight()) / 2 + 12);
          BufferedImage outImage2 = new BufferedImage(400, 485, BufferedImage.TYPE_4BYTE_ABGR);
          Graphics2D outg2 = outImage2.createGraphics();
          outg2.drawImage(outImage, 0, 0, outImage.getWidth(), outImage.getHeight(), null);
          outg2.setColor(Color.BLACK);
          outg2.setFont(new Font("微軟雅黑", Font.BOLD, 30)); // 字體、字型、字號
          outg2.drawString(productName2, 200 - strWidth2 / 2, outImage.getHeight() + (outImage2.getHeight() - outImage.getHeight()) / 2 + 5);
          outg2.dispose();
          outImage2.flush();
          outImage = outImage2;
        } else {
          outg.drawString(remark, 200 - strWidth / 2, image.getHeight() + (outImage.getHeight() - image.getHeight()) / 2 + 12); // 畫文字
        }
        outg.dispose();
        outImage.flush();
        image = outImage;
      }
      logo.flush();
      image.flush();
      baos = new ByteArrayOutputStream();
      baos.flush();
      ImageIO.write(image, "png", baos); //不用MatrixToImageWriter
      //ImageIO.write(image, "png", new File(savePath));//直接寫入某路徑
      return Base64.encodeBase64URLSafeString(baos.toByteArray());
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      IOUtils.closeQuietly(baos);
    }
    return null;
  }
 
  /**
   * 生成二維碼bufferedImage圖片
   * @param content 編碼內(nèi)容
   * @param barcodeFormat 編碼類型
   * @param width 圖片寬度
   * @param height 圖片高度
   * @param hints 設(shè)置參數(shù)
   * @return
   */
  private static BufferedImage toBufferedImage(String content, BarcodeFormat barcodeFormat, int width, int height,
      Map<EncodeHintType, ?> hints) {
    MultiFormatWriter multiFormatWriter = null;
    BitMatrix bitMatrix = null;
    BufferedImage image = null;
    try {
      multiFormatWriter = new MultiFormatWriter();
      // 參數(shù)順序分別為:編碼內(nèi)容,編碼類型,生成圖片寬度,生成圖片高度,設(shè)置參數(shù)
      bitMatrix = multiFormatWriter.encode(content, barcodeFormat, width, height, hints);
      int w = bitMatrix.getWidth();
      int h = bitMatrix.getHeight();
      image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
      // 開始利用二維碼數(shù)據(jù)創(chuàng)建Bitmap圖片,分別設(shè)為黑(0xFFFFFFFF)白(0xFF000000)兩色
      for (int x = 0; x < w; x++) {
        for (int y = 0; y < h; y++) {
          image.setRGB(x, y, bitMatrix.get(x, y) ? MatrixToImageConfig.BLACK : MatrixToImageConfig.WHITE);
        }
      }
    } catch (WriterException e) {
      e.printStackTrace();
    }
    return image;
  }
 
  /**
   * 設(shè)置二維碼的格式參數(shù)
   * @return
   */
  private static Map<EncodeHintType, Object> toDecodeHintType() {
    // 用于設(shè)置QR二維碼參數(shù)
    Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
    // 設(shè)置QR二維碼的糾錯級別(H為最高級別)具體級別信息
    hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
    // 設(shè)置編碼方式
    hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
    hints.put(EncodeHintType.MARGIN, 0);
    //hints.put(EncodeHintType.MAX_SIZE, 350);//Only applicable to Data Matrix now
    //hints.put(EncodeHintType.MIN_SIZE, 100);//Only applicable to Data Matrix now
    return hints;
  }
  
  /**
   * 二維碼解碼
   * 
   * @param imgPath
   * @return 
   */
  public static String decode(String imgPath) {
    BufferedImage image = null;
    Result result = null;
    try {
      File file = new File(imgPath);
      image = ImageIO.read(file);
      if (image == null) {
        System.out.println("the decode image may be not exit.");
      }
      LuminanceSource source = new BufferedImageLuminanceSource(image);
      BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
      Map<DecodeHintType, Object> hints = new HashMap<DecodeHintType, Object>();
      hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
      result = new MultiFormatReader().decode(bitmap, hints);
      return result.getText();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
}

/**
 * Logo圖片配置
 */
class LogoConfig {
  // logo默認邊框顏色
  public static final Color DEFAULT_BORDERCOLOR = Color.WHITE;
  // logo默認邊框?qū)挾?
  public static final int DEFAULT_BORDER = 2;
  // logo大小默認為照片的1/5
  public static final int DEFAULT_LOGOPART = 5;
 
  private final int border = DEFAULT_BORDER;
  private final Color borderColor;
  private final int logoPart;
 
  /**
   * Creates a default config with on color {@link #BLACK} and off color
   * {@link #WHITE}, generating normal black-on-white barcodes.
   */
  public LogoConfig() {
    this(DEFAULT_BORDERCOLOR, DEFAULT_LOGOPART);
  }
 
  public LogoConfig(Color borderColor, int logoPart) {
    this.borderColor = borderColor;
    this.logoPart = logoPart;
  }
 
  public Color getBorderColor() {
    return borderColor;
  }
 
  public int getBorder() {
    return border;
  }
 
  public int getLogoPart() {
    return logoPart;
  }
}

生成條形碼

import java.awt.image.BufferedImage;
import java.io.File;
 
import javax.imageio.ImageIO;
 
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
 
/**
 * ZXing條形碼編碼/解碼
 */
public class ZxingCode {
 
  /**
   * 條形碼編碼
   * 
   * @param contents
   * @param width
   * @param height
   * @param imgPath
   */
  public static void encode(String contents, int width, int height, String imgPath) {
    int codeWidth = 3 + // start guard
        (7 * 6) + // left bars
+ // middle guard
        (7 * 6) + // right bars
        3; // end guard
    codeWidth = Math.max(codeWidth, width);
    try {
      BitMatrix bitMatrix = new MultiFormatWriter().encode(contents,BarcodeFormat.EAN_13, codeWidth, height, null);
      MatrixToImageWriter.writeToFile(bitMatrix, "png", new File(imgPath));
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 
  /**
   * 條形碼解碼
   * 
   * @param imgPath
   * @return String
   */
  public static String decode(String imgPath) {
    BufferedImage image = null;
    Result result = null;
    try {
      image = ImageIO.read(new File(imgPath));
      if (image == null) {
        System.out.println("the decode image may be not exit.");
      }
      LuminanceSource source = new BufferedImageLuminanceSource(image);
      BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
      result = new MultiFormatReader().decode(bitmap, null);
      return result.getText();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
  
  /**
   * @param args
   */
  public static void main(String[] args) {
    String imgPath = "F:/zxing_EAN-13.png";
    String contents = "6926557300360";
    int width = 105, height = 50;
    encode(contents, width, height, imgPath);
    System.out.println("finished zxing EAN-13 encode.");
    String decodeContent = decode(imgPath);
    System.out.println("解碼內(nèi)容如下:" + decodeContent);
    System.out.println("finished zxing EAN-13 decode.");
  }
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Mybatis關(guān)聯(lián)查詢遇到的坑-無主鍵的關(guān)聯(lián)數(shù)據(jù)去重問題

    Mybatis關(guān)聯(lián)查詢遇到的坑-無主鍵的關(guān)聯(lián)數(shù)據(jù)去重問題

    這篇文章主要介紹了Mybatis關(guān)聯(lián)查詢遇到的坑-無主鍵的關(guān)聯(lián)數(shù)據(jù)去重問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-03-03
  • Java 垃圾回收機制詳解(動力節(jié)點Java學(xué)院整理)

    Java 垃圾回收機制詳解(動力節(jié)點Java學(xué)院整理)

    在系統(tǒng)運行過程中,會產(chǎn)生一些無用的對象,這些對象占據(jù)著一定的內(nèi)存,如果不對這些對象清理回收無用對象的內(nèi)存,可能會導(dǎo)致內(nèi)存的耗盡,所以垃圾回收機制回收的是內(nèi)存。下面通過本文給大家詳細介紹java垃圾回收機制,一起學(xué)習吧
    2017-02-02
  • java單例模式學(xué)習示例

    java單例模式學(xué)習示例

    java中單例模式是一種常見的設(shè)計模式,單例模式分三種:懶漢式單例、餓漢式單例、登記式單例三種,下面提供了單例模式的示例
    2014-01-01
  • 匯總java調(diào)用python方法

    匯總java調(diào)用python方法

    這篇文章主要為大家詳細介紹了java調(diào)用python的方法,文章中介紹了三種java調(diào)用python方法,感興趣的朋友可以參考一下
    2016-02-02
  • Java中的字符型文件流FileReader和FileWriter詳細解讀

    Java中的字符型文件流FileReader和FileWriter詳細解讀

    這篇文章主要介紹了Java中的字符型文件流FileReader和FileWriter詳細解讀,與字節(jié)型文件流不同,字節(jié)型文件流讀取和寫入的都是一個又一個的字節(jié),而字符型文件流操作的單位是一個又一個的字符,字符型流認為一個字母是一個字符,而一個漢字也是一個字符,需要的朋友可以參考下
    2023-10-10
  • springboot~nexus項目打包要注意的地方示例代碼詳解

    springboot~nexus項目打包要注意的地方示例代碼詳解

    這篇文章主要介紹了springboot~nexus項目打包要注意的地方,本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-07-07
  • 全面解析Spring Security 內(nèi)置 Filter

    全面解析Spring Security 內(nèi)置 Filter

    這篇文章主要介紹了Spring Security 內(nèi)置 Filter的相關(guān)知識,本文給大家介紹的非常詳細,對大家的學(xué)習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-07-07
  • Go反射底層原理及數(shù)據(jù)結(jié)構(gòu)解析

    Go反射底層原理及數(shù)據(jù)結(jié)構(gòu)解析

    這篇文章主要介紹了Go反射底層原理及數(shù)據(jù)結(jié)構(gòu)解析,反射的實現(xiàn)和interface的組成很相似,都是由“類型”和“數(shù)據(jù)值”構(gòu)成,下面小編分享更多相關(guān)內(nèi)容需要的小伙伴可以參考一下
    2022-06-06
  • SpringBoot打包成Docker鏡像的幾種實現(xiàn)方式

    SpringBoot打包成Docker鏡像的幾種實現(xiàn)方式

    Spring Boot是一個用于構(gòu)建獨立的、可執(zhí)行的Spring應(yīng)用程序的框架,結(jié)合使用Spring Boot和Docker,可以方便地將應(yīng)用程序部署到不同的環(huán)境中本文,主要介紹了SpringBoot打包成Docker鏡像的幾種實現(xiàn)方式,感興趣的可以了解一下
    2024-01-01
  • Spring Data Jpa 自動生成表結(jié)構(gòu)的方法示例

    Spring Data Jpa 自動生成表結(jié)構(gòu)的方法示例

    這篇文章主要介紹了Spring Data Jpa 自動生成表結(jié)構(gòu)的方法示例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友們下面隨著小編來一起學(xué)習學(xué)習吧
    2019-04-04

最新評論