Created
December 28, 2013 02:42
-
-
Save lichengwu/8155504 to your computer and use it in GitHub Desktop.
最简单的方式把一个InputStream转换成String
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 最简单的方式把一个InputStream转换成String | |
* | |
* @author lichengwu | |
* @version 1.0 | |
* @created 2013-12-28 10:37 AM | |
*/ | |
public class InputStreamAsString { | |
public static void main(String[] args) throws IOException { | |
InputStream inputStream = new URL("http://blog.lichengwu.cn/atom.xml").openStream(); | |
String str = new Scanner(inputStream).useDelimiter("\\A").next(); | |
System.out.println(str); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment