bytearraytest.java
来自「用java编写的一些初级代码」· Java 代码 · 共 31 行
JAVA
31 行
import java.io.*;
public class ByteArrayTest {
public static void main(String args[]){
String tmp="abcdefghijklmnopqrstuvwxyz";
byte [] src = tmp.getBytes();
ByteArrayInputStream input = new ByteArrayInputStream(src);
ByteArrayOutputStream output = new ByteArrayOutputStream();
new ByteArrayTest().transform(input,output);
byte []result = output.toByteArray();
System.out.println(new String(result));
}
public void transform (InputStream in,OutputStream out)
{
int c=0;
try
{
while ((c=in.read())!=-1)
{
int C=(int)Character.toUpperCase((char)c);
out.write(C);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?