Java InputStream to String Covertion

Found this small method to convert InputStream to String, This will help to avoid using Apache IOUtils etc.,

 static String convertStreamToString(java.io.InputStream is) {
        java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }


Comments

Popular posts from this blog

Java Task Service - Sterling Integrator

Hibernate Connection Fails if there is Database inconsistency or DB fail-over (Oracle RAC)

​ Configure External Databases to IBM Sterling B2B Integrator