Import java. io. *; public class ByteArrayDemo {public static void main (String [] args) {String str = "abcdefghijklmnopqrstuvwxyz"; byte [] B = str. getBytes (); ByteArrayInputStream in = new ByteArrayInputStream (B); ByteArrayOutputStream out = new ByteArrayOutputStream (); try {new ByteArrayDemo (). transform (in, out); byte [] outb = out. toByteArray (); System. out. println (new String (outb);} catch (IOException e) {// TODO Auto -Generated catch blocke. printStackTrace () ;}} public void transform (InputStream in, OutputStream out) throws IOException {int c = 0; while (c = in. read ())! =-1) {out. write (int) Character. toUpperCase (char) c ));}}}
Descriptions of several functions in the program <Strong? Http: www.bkjia.com kf ware vc "target =" _ blank "class =" keylink "> Vc3ryb25np1_vcd4kpha + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20140503/2014050309250497.jpg" alt = "\">