Java InputStream to String Java InputStream to String Java递归 Java InputStream to String import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.Scanner; public class InputStreamToString { public static void main(String args[]) throws Exception{ System.out.println("Enter a string ::"); Scanner sc = new Scanner(System.in); byte[] data = sc.next().getBytes(); int size = data.length; byte[] b = new byte[size]; InputStream Inputstream = new ByteArrayInputStream(data); Inputstream.read(b); String str = new String(b); System.out.println(str); } } Java InputStream to String Java递归