Java IO之内存流
?
package com.chenzehe.test.io;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;public class ByteArrayStreamDemo {public static void main(String[] args) {String helloworld = "helloworld";ByteArrayInputStream bis = new ByteArrayInputStream(helloworld.getBytes());ByteArrayOutputStream bos = new ByteArrayOutputStream();int temp = 0;while ((temp = bis.read()) != -1) {char c = (char) temp;bos.write(Character.toUpperCase(c));}System.out.println(bos.toString());}}