当前位置:网站首页>Write and read system temporary files: createtempfile and tempfilecontent[easy to understand]
Write and read system temporary files: createtempfile and tempfilecontent[easy to understand]
2022-07-27 12:03:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Write java When , Sometimes the data found is temporarily unavailable , We can write it to a temporary file .
I found this good method when writing the project today .
take context Write the contents of to the temporary file
@PostMapping("/temp")
@ResponseBody
String temp(@RequestParam String content) throws IOException {
File tempFile = Files.createTempFile(null, null).toFile();
FileCopyUtils.copy(content.getBytes(StandardCharsets.UTF_8), tempFile);
return tempFile.getName();
}The file is stored in this path :C:\Users\my\AppData\Local\Temp
Take it out when you need it
json = Utils.tempFileContent(fileName);
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/128213.html Link to the original text :https://javaforall.cn
边栏推荐
猜你喜欢

源码编译安装LAMP

Why is ack=seq+1 when TCP shakes hands three times
![[untitled] multimodal model clip](/img/f0/8ae72ae0845372b6fe2866fae83f52.png)
[untitled] multimodal model clip

Japan Fukushima waste dump safety monitoring agreement will recognize the "safety" of the sea discharge plan

Adobe audit prompts that the sampling rate of audio input does not match the output device - problem solving

SMA TE: Semi-Supervised Spatio-Temporal RepresentationLearning on Multivariate Time Series

B 站 713 事故后的多活容灾建设|TakinTalks 大咖分享

Wilcoxon rank sum and signed rank

MySQL数据库主从复制集群原理概念以及搭建流程

广东:剧本杀等新行业新业态场所,消防安全监管不再“缺位”
随机推荐
LNMP architecture setup (deploy discuz Forum)
LNMP架构搭建(部署Discuz论坛)
你尚未连接代理服务器可能有问题或地址不正确(如何查看代理服务器ip)
希腊字母读法
Newticker uses
新版数据仓库的同步使用参考(新手向)
【无标题】多模态模型 CLIP
shell中的while循环实例
Keil MDK编译出现..\USER\stm32f10x.h(428): error: #67: expected a “}“错误的解决办法
go入门篇 (3)
Conversion between multiple bases
Temporary use of solo, difficult choice of Blog
微博评论爬虫+可视化
STM32编译出现error: L6235E: More than one section matches selector - cannot all be FIRST/L
[machine learning whiteboard derivation series] learning notes - probability graph model and exponential family distribution
系统临时文件的写和读:createTempFile和tempFileContent[通俗易懂]
SMA TE: Semi-Supervised Spatio-Temporal RepresentationLearning on Multivariate Time Series
Source code compilation and installation lamp
Could not load dynamic library ‘libcudnn.so.8‘;
意外收获史诗级分布式资源,从基础到进阶都干货满满,大佬就是强!