import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
public class ImgTransform {
private static final Logger LOG = LogManager.getLogger(ImgTransform.class);
/**
* 图片转成十六进制
*
*/
@Test
public String platePhotoURL() {
File file = new File("C:\\Users\\zhangzq\\Desktop\\123456.jpg");
if (file.exists()) {
FileInputStream fs = null;
FileChannel fc = null;
String imge = "";
try {
fs = new FileInputStream(file);
fc = fs.getChannel();
if (fs.getChannel().size() <= 0) {
return "";
}
byte[] data = new byte[(int) fc.size()];
int reads = 0;// 循环次数
int re = 0; // 获取值
while ((re = (int)
图片转成16进制,16进制转图片。
最新推荐文章于 2023-08-17 09:16:27 发布