package com.lesson24;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public class ByteWriteTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str = "adsfasdfas";
ByteArrayInputStream bin = new ByteArrayInputStream(str.getBytes());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
tra(bin, bout);
System.out.println(new String(bout.toByteArray()));
}
// 将一个流转成一个别的流啊
public static void tra(ByteArrayInputStream bin, ByteArrayOutputStream bout) {
while (true) {
int ch = bin.read();
if (ch == -1) {
break;
}
// 字母小写转成大写的
int re = Character.toUpperCase(ch);
bout.write((byte) ch);
}
}
}