当前位置:网站首页>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();
}边栏推荐
- IP home online query platform
- Download address collection of various versions of devaexpress
- [cmake] cmake link SQLite Library
- Realize the reuse of components with different routing parameters and monitor the changes of routing parameters
- Basic components and intermediate components
- [HCAI] learning summary OSI model
- File operation serialization recursive copy
- La différence entre le let Typescript et le Var
- JS monitors empty objects and empty references
- CentOS switches and installs mysql5.7 and mysql8.0
猜你喜欢
![[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)](/img/7f/3d6b6ea5319f7165e07baf0a78d318.jpg)
[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)

Basic components and intermediate components

Inno setup production and installation package

Setting up the development environment of dataworks custom function

Mise en place d'un environnement de développement de fonctions personnalisées

Inno Setup 制作安装包

Interview questions about producers and consumers (important)

Selenium key knowledge explanation

JS monitors empty objects and empty references

1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
随机推荐
Deep learning parameter initialization (I) Xavier initialization with code
Wireshark software usage
Use of generics
Longest common prefix and
带你全流程,全方位的了解属于测试的软件事故
[most detailed] latest and complete redis interview book (50)
How to specify the execution order for multiple global exception handling classes
Use the jvisualvm tool ----- tocmat to start JMX monitoring
7.2刷题两个
PHP install composer
MySQL mistakenly deleted the root account and failed to log in
The difference between typescript let and VaR
Jeecg menu path display problem
SecureCRT password to cancel session recording
Laravel frame step pit (I)
【最詳細】最新最全Redis面試大全(50道)
【最详细】最新最全Redis面试大全(50道)
Basic components and intermediate components
[untitled]
TCP cumulative acknowledgement and window value update