图片文件转String,转byte[]

版权声明:copyright:eather_liang https://blog.csdn.net/lgf15279707407/article/details/84966651
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class ImageChangeToString {

    public static void main(String[] args) throws IOException{
        File imgFile = new File("D://watermark/001.jpg");
        FileInputStream fis = new FileInputStream(imgFile);
        byte[] bytes = new byte[fis.available()];
        fis.read(bytes);
        fis.close();
        String imgStr = new String(bytes);
        System.out.println( imgStr);
    }
}
展开阅读全文

没有更多推荐了,返回首页