黑马程序员:将字符串的所有字符转化为大写(ByteArrayOutPutStream/ByteArrayInPutStream)
来源:互联网 发布:ubuntu引导windows 编辑:程序博客网 时间:2024/06/05 17:40
import java.io.*;
/**
*
*/
/**
* @author Administrator
*
*/
public class ByteArrayTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String tem = "abcdefgh";
byte[] src = tem.getBytes();
ByteArrayInputStream in = new ByteArrayInputStream(src);
ByteArrayOutputStream out = new ByteArrayOutputStream();
transform(in, out);
byte[] result = out.toByteArray();
System.out.print(new String(result));
transform(System.in, System.out); // 键盘输入屏幕输出 ,ctrl+"z"结束键盘输入
}
public static void transform(InputStream in, OutputStream out) {
try {
int ch = in.read();
while (ch != -1) {
int reUpper = Character.toUpperCase((char) ch);
out.write(reUpper);
ch=in.read();
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
}
- 黑马程序员:将字符串的所有字符转化为大写(ByteArrayOutPutStream/ByteArrayInPutStream)
- 把字符串的所有字符转化为大写
- 黑马程序员——【Java】IO——操作字符数组的IO对象:ByteArrayInputStream & ByteArrayOutputStream
- ByteArrayInputStream和ByteArrayOutputStream使用-黑马程序员
- 黑马程序员 IO流 ByteArrayInputStream与ByteArrayOutputStream
- 将数字转化为大写汉字的字符串
- ;将data中的字符串转化为大写
- [Shell]将字符串转化为大写/小写
- 将阿拉伯数字转化为人民币的大写
- 把字符串的所有字符转化为小写
- rails 将字符串的起始字母大写并将下划线转化为空格
- rails 将字符串的起始字母大写并将下划线转化为空格
- linux C++字符串 //去除\r\n //字符串分割 /字符串转化为大写格式 //将字符串转换为long long //将字符串(八进制)转化为无符串整型
- 第十章p202的程序:将一个全是字母的字符串转化为大写(用栈来传递)
- 104.把字符串奇数位上的小写字母转化为大写且其他字符不变
- 利用函数启动另外的函数,将输入的字符串转化为大写
- 汇编程序:将字符串中所有大写字符转为小写
- 将ss所指字符串中所有下标为奇数位置上的字母转换为大写
- 树状控件支持鼠标拖动
- USB转232串口驱动程序
- [解决]ORA-12514:TNS:监听进程不能解析SERVICE_NAME
- WP7 Dev 101 【2】 你所要了解的一些数字
- 定义类
- 黑马程序员:将字符串的所有字符转化为大写(ByteArrayOutPutStream/ByteArrayInPutStream)
- ORACLE10G + WindowsXP下无法启动oracleDBConsole的解决方法
- WP7 Dev 101 【3】 向Windows Phone 7手机部署应用程序
- android stagefright框架(一)Video Playback的流程
- Oracle的5个服务
- 读写器通讯协议
- [转]Ultra Fractal教程系列04——快速入门教程01——创建一个分形图像
- 关于java -server命令出现“Error: no `server’ JVM at … jvm.dll”的解决方案
- [转]Ultra Fractal教程系列05——快速入门教程02——改变公式参数