读取本地文件并且BASE64转码成字符串

版权声明:本文为博主原创文章,随意转载。 https://blog.csdn.net/king13127/article/details/78455959
	public static void main(String[] args) throws IOException {
		String docUploadPath = "D:\\home\\gg.docx";
		File refereeFile = new File(docUploadPath);
		byte[] refereeFileOriginalBytes = FileUtils.readFileToByteArray(refereeFile);
		byte[] refereeFileBase64Bytes = Base64.encodeBase64(refereeFileOriginalBytes);
		String UpFile = new String(refereeFileBase64Bytes, "UTF-8");
		System.out.println(UpFile);
	}

猜你喜欢

转载自blog.csdn.net/king13127/article/details/78455959