当前位置:网站首页>Bytearraystream case of IO
Bytearraystream case of IO
2022-06-22 11:40:00 【ITzhongzi】
Core code
package ioDemo;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
public class ByteArrayStreamDemo {
public static void main(String[] args) {
byteArray();
}
// Extract English letters from a string
public static void byteArray() {
String info = "123,hhh,234#$%";
ByteArrayInputStream bais = new ByteArrayInputStream(info.getBytes(StandardCharsets.UTF_8));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
System.out.println(bais);
int curr = -1;
while ((curr = bais.read()) != -1) {
if ((curr >= 65 && curr <= 90) || (curr >= 97 && curr <= 122))
baos.write(curr);
}
// No need to close the flow , Byte arrays are memory based streams of operations , The root file does not matter , All do not close .
System.out.println(baos.toString());
}
}
边栏推荐
- Customization scheme for DAPP system development mode of smart contract
- AGCO AI frontier promotion (6.22)
- 奋斗吧,程序员——第四十章 一面风情深有韵,半笺娇恨寄幽怀
- Attack and defense drill | threat hunting practice case based on att & CK
- 高考生父亲深夜自述,最在意的不是孩子成绩,转折点一点都不假
- “不敢去怀疑代码,又不得不怀疑代码”记一次网络请求超时分析
- Intensive reading: generative adversarial imitation learning
- 什么是同源???跨域错误???如何解决???
- 【软工】计划和项目管理
- GEE——Global Flood Database v1 (2000-2018)
猜你喜欢

From prototype chain to inheritance, illustrate the context and recommend collection

"Dare not doubt the code, but have to doubt the code" a network request timeout analysis

Rtklib postpos carding (taking single point positioning as an example)

牛客挑战赛53C

如果你是个半路出家的程序员,请一字一句的看完

Two ways of traversing binary tree: preorder, inorder and postorder

微信小程序项目实例——图片处理小工具(自制低配版美图秀秀)

【软工】 软件体系结构

electron添加SQLite数据库

TCP connection establishment process (in-depth understanding of the source code and three handshakes)
随机推荐
机器人强化学习——Sim-to-Real Robot Learning from Pixels with Progressive Nets (2017)
6-10 global status management - Global store
Puzzle (019) plane forward problem
social phobia? When I introduce myself, my brain goes blank?
xlrd. biffh. XLRDError: Excel xlsx file; Not supported solution
牛客挑战赛57C题解
Should the theme of the IDE be bright or dark? Here comes the ultimate answer!
安装pygame
Wechat applet project example - image processing gadget (self-made low configuration version of Meitu XiuXiu)
IO之Reader案例
奋斗吧,程序员——第四十章 一面风情深有韵,半笺娇恨寄幽怀
IO操作案例合集
Typical life cycle model of information system project
How much memory does a TCP connection occupy?
牛客挑战赛54F题解 & 李超树学习笔记
How to improve customer conversion rate on the official website
CF751D Difficult Mountain
CF736 D2
TCP connection establishment process (in-depth understanding of the source code and three handshakes)
1.11 haas506 2.0开发教程-driver-RTC(仅支持2.2以上版本)