package learn.io.byteStream.arrayStream;

import java.io.ByteArrayInputStream;

/**
 * ByteArrayInputStream
 * ByteArrayOutputStream
 * @author suzheng
 * @version v.1.0
 */
public class TestByteArrayStream {

    public static void main(String[] args) {
        testInputStream();
    }

    private static void testInputStream() {
        String s = " Japan's Fujifilm Holdings is set to take over Xerox Corp in a $6.1 billion deal, combining the U.S. company into their existing joint venture to gain scale and cut costs amid declining demand for office printing.";
        System.out.println(s.length());
        ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes());
        System.out.println(inputStream.available());
        System.out.println(inputStream.markSupported());
    }
}

@@ -71,16 +71,54 @@
 tStream;
+%0Aimport java.io.ByteArrayOutputStream;
 %0A%0A/**%0A *
@@ -164,16 +164,19 @@
 tStream%0A
+ *%0A
  * @auth
@@ -615,71 +615,131 @@
     
-System.out.println(s.length());%0A        ByteArrayInputStream in
+ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());%0A        byte%5B%5D bytes = new byte%5B24%5D;%0A        ByteArrayOut
 putS
@@ -744,16 +744,19 @@
 tStream 
+os 
 = new By
@@ -754,34 +754,35 @@
  = new ByteArray
-In
+Out
 putStream(s.getB
@@ -779,73 +779,391 @@
 eam(
-s.getBytes());%0A        System.out.println(inputStream.available()
+bytes.length);%0A        if (is.markSupported()) %7B%0A            is.mark(1);%0A        %7D%0A        int length;%0A        length = is.read(bytes, 0, bytes.length);%0A        os.write(bytes, 0, length);%0A        System.out.println(os.toString());%0A        if (is.markSupported()) %7B%0A            is.reset();%0A        %7D%0A        length = is.read(bytes, 0, bytes.length);%0A        os.write(bytes, 0, length
 );%0A 
@@ -1192,33 +1192,19 @@
 tln(
-inputStream.markSupported
+os.toString
 ());

test byte array stream