当前位置:网站首页>29io stream, byte output stream continue write line feed
29io stream, byte output stream continue write line feed
2022-07-06 05:26:00 【dengfengling999】
Additional writing / Sequel
FileOutputStream(String name,boolean append) Create a direction with the specified name The output file stream that writes data in the folder of
FileOutputStream(File file,boolean append) Create a File Object represents the file output stream in which data is written
Parameters :
String name,File file: The destination where the data is written
boolean append: Add write switch true: The created object will not overwrite the original file , Continue to append write data at the end of the file false Create a new file , Overwrite source file
Line break :
Windows:\r\n
Linus:/n
Mac:/r
Detailed code :
package demo29 Text output stream continue and wrap ;
/*
Additional writing / Sequel
FileOutputStream(String name,boolean append) Create a direction with the specified name The output file stream that writes data in the folder of
FileOutputStream(File file,boolean append) Create a File Object represents the file output stream in which data is written
Parameters :
String name,File file: The destination where the data is written
boolean append: Add write switch
true: The created object will not overwrite the original file , Continue to append write data at the end of the file
false Create a new file , Overwrite source file
*/
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
public class DenoOutputStream {
public static void main(String[] args) throws IOException {
//1. Create a FileOutputStream object , The destination to which the data is to be written in the constructor
FileOutputStream fos=new FileOutputStream("E:\\ Multithreading \\c.txt",true);
for (int i = 1; i <=10 ; i++) {
fos.write(" Hello ".getBytes());
fos.write("\r\n".getBytes());
}
fos.close();
}
}
result : establish c.txt File write data
At the beginning :
After running the code for the first time :
Second operation :
边栏推荐
- Three methods of Oracle two table Association update
- Some common skills on unity inspector are generally used for editor extension or others
- Review of double pointer problems
- Driver development - hellowdm driver
- MySQL if and ifnull use
- 【torch】|torch.nn.utils.clip_grad_norm_
- Three. JS learning - light and shadow (understanding)
- flutter 实现一个有加载动画的按钮(loadingButton)
- TCP three handshakes you need to know
- Sliding window problem review
猜你喜欢
Configuration file converted from Excel to Lua
Deep learning -yolov5 introduction to actual combat click data set training
[cloud native] 3.1 kubernetes platform installation kubespher
04. Project blog log
First acquaintance with CDN
nacos-高可用seata之TC搭建(02)
Please wait while Jenkins is getting ready to work
02. Develop data storage of blog project
05. Security of blog project
Three methods of Oracle two table Association update
随机推荐
GAMES202-WebGL中shader的编译和连接(了解向)
Class inheritance in yyds dry inventory C
MySQL time processing
UCF (summer team competition II)
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
idea一键导包
Promotion hung up! The leader said it wasn't my poor skills
Note the various data set acquisition methods of jvxetable
EditorUtility. The role and application of setdirty in untiy
自建DNS服务器,客户端打开网页慢,解决办法
04. Project blog log
Cve-2019-11043 (PHP Remote Code Execution Vulnerability)
Codeforces Round #804 (Div. 2) Editorial(A-B)
[mask requirements of OSPF and Isis in multi access network]
01. 开发博客项目之项目介绍
Three.js学习-光照和阴影(了解向)
Compilation and connection of shader in games202 webgl (learn from)
Jvxetable implant j-popup with slot
pix2pix:使用条件对抗网络的图像到图像转换
【torch】|torch. nn. utils. clip_ grad_ norm_