convert InputStream to String

 

 

    public String getContent(final URL url) {
        try {
            InputStream inputStream = url.openStream();
            return new Scanner(inputStream).useDelimiter("\\A").next();
        }
        catch (final Exception e) {
          
        }

        return "";
    }
 

你可能感兴趣的:(Inputstream)