User Tools

Site Tools


inputstream_to_string

InputStream to String

Java Standard Lösung:

public static String convertStreamToString(java.io.InputStream is) {
    try {
        return new java.util.Scanner(is).useDelimiter("\\A").next();
    } catch (java.util.NoSuchElementException e) {
        return null;
    }
}

Apache Commons IO Lösung: Klasse IOUtils

inputstream_to_string.txt · Last modified: 2013/12/13 09:44 by mihael