当前位置:网站首页>Introduction of transformation flow
Introduction of transformation flow
2022-07-03 07:21:00 【four thousand three hundred and forty-three】




InputStreamReader And OutputStreamWriter It is also a processing flow
package TransformStream;
import org.junit.Test;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
public class InputStreamReaderTest {
@Test
public void test1() throws IOException {
FileInputStream fis = new FileInputStream("hello2.txt");
// Use the default character set take Data conversion of byte stream ( stay IDEA Medium is the default UTF-8)
InputStreamReader isr = new InputStreamReader(fis);
// Specify character set take Data conversion of byte stream
// InputStreamReader isr = new InputStreamReader(fis,"gbk");
char[] buffer = new char[5];
int len ;
while((len = isr.read(buffer))!=-1){
String str= new String(buffer);
System.out.print(buffer);
}
// Transformation flow is also processing flow , So just close the outer layer
isr.close();
}
}
OutputStreamWriter
// OutputStreamWriter
@Test
public void test2() throws IOException {
FileReader fr = new FileReader("hello2.txt");
FileOutputStream fos = new FileOutputStream("hello3.txt");
OutputStreamWriter osw = new OutputStreamWriter(fos,"gbk");
char[] buffer = new char[5];
int len;
while((len = fr.read(buffer))!=-1){
osw.write(buffer,0,len);
}
fr.close();
osw.close();
}边栏推荐
- 1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
- 7.2 brush two questions
- Raspberry pie update tool chain
- Homology policy / cross domain and cross domain solutions /web security attacks CSRF and XSS
- 专题 | 同步 异步
- Spa single page application
- [set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
- php artisan
- [attribute comparison] defer and async
- OSI knowledge sorting
猜你喜欢

7.2刷题两个

Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record
![Gridome + strapi + vercel + PM2 deployment case of [static site (3)]](/img/65/8d79998e96a2c74ba6e237bee652c6.jpg)
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]

dataworks自定義函數開發環境搭建

Distributed transactions

Basic knowledge about SQL database

C代码生产YUV420 planar格式文件

3311. Longest arithmetic

Dora (discover offer request recognition) process of obtaining IP address

JMeter JSON extractor extracts two parameters at the same time
随机推荐
4EVERLAND:IPFS 上的 Web3 开发者中心,部署了超过 30,000 个 Dapp!
Strategy mode
高并发内存池
php安装composer
《指环王:力量之戒》新剧照 力量之戒铸造者亮相
IP home online query platform
3311. Longest arithmetic
Specified interval inversion in the linked list
Discussion on some problems of array
Common APIs
docket
Mise en place d'un environnement de développement de fonctions personnalisées
[set theory] partition (partition | partition example | partition and equivalence relationship)
sharepoint 2007 versions
Dora (discover offer request recognition) process of obtaining IP address
When MySQL inserts Chinese into the database, there is a diamond question mark garbled code
Le Seigneur des anneaux: l'anneau du pouvoir
Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record
CentOS php7.3 installing redis extensions
Jeecg menu path display problem