/** Read input stream to string. * @param in the stream to read from (until EOF) * @return the String parsed from stream (default Charset) * @throws IOException if unable to read the stream (or handle the charset) */ public static String toString(InputStream in) throws IOException { return toString(in,(Charset)null); }
/** Read input stream to string. * @param in the stream to read from (until EOF) * @param encoding the encoding to use (can be null to use default Charset) * @return the String parsed from the stream * @throws IOException if unable to read the stream (or handle the charset) */ public static String toString(InputStream in,String encoding) throws IOException { return toString(in, encoding==null?null:Charset.forName(encoding)); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,null); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,(Charset)null); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,null); }
/** Read input stream to string. * @param in the stream to read from (until EOF) * @return the String parsed from stream (default Charset) * @throws IOException if unable to read the stream (or handle the charset) */ public static String toString(InputStream in) throws IOException { return toString(in,(Charset)null); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,null); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,null); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,null); }
/** Read input stream to string. */ public static String toString(InputStream in) throws IOException { return toString(in,null); }
/** Read input stream to string. */ public static String toString(InputStream in,String encoding) throws IOException { return toString(in, encoding==null?null:Charset.forName(encoding)); }
/** Read input stream to string. * @param in the stream to read from (until EOF) * @param encoding the encoding to use (can be null to use default Charset) * @return the String parsed from the stream * @throws IOException if unable to read the stream (or handle the charset) */ public static String toString(InputStream in,String encoding) throws IOException { return toString(in, encoding==null?null:Charset.forName(encoding)); }
/** * @deprecated use {@link #parse(Reader)} * @param in * Reader containing JSON object or array. * @return A Map, Object array or primitive array parsed from the JSON. */ @Deprecated public static Object parse(InputStream in) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),false); }
/** * @param in * Reader containing JSON object or array. * @return A Map, Object array or primitive array parsed from the JSON. * @throws IOException if unable to parse * @deprecated use {@link #parse(Reader)} */ @Deprecated public static Object parse(InputStream in) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),false); }
/** * @deprecated use {@link #parse(Reader)} * @param in * Reader containing JSON object or array. * @return A Map, Object array or primitive array parsed from the JSON. */ @Deprecated public static Object parse(InputStream in) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),false); }
/** * @deprecated use {@link #parse(Reader, boolean)} * @param in * Stream containing JSON object or array. * @param stripOuterComment * If true, an outer comment around the JSON is ignored. * @return A Map, Object array or primitive array parsed from the JSON. */ @Deprecated public static Object parse(InputStream in, boolean stripOuterComment) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),stripOuterComment); }
/** * @deprecated use {@link #parse(Reader, boolean)} * @param in * Stream containing JSON object or array. * @param stripOuterComment * If true, an outer comment around the JSON is ignored. * @return A Map, Object array or primitive array parsed from the JSON. */ @Deprecated public static Object parse(InputStream in, boolean stripOuterComment) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),stripOuterComment); }
/** * @deprecated use {@link #parse(Reader)} * @param in * Reader containing JSON object or array. * @return A Map, Object array or primitive array parsed from the JSON. */ @Deprecated public static Object parse(InputStream in) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),false); }
/** * @deprecated use {@link #parse(Reader)} * @param in * Reader containing JSON object or array. * @return A Map, Object array or primitive array parsed from the JSON. */ @Deprecated public static Object parse(InputStream in) throws IOException { return DEFAULT.parse(new StringSource(IO.toString(in)),false); }
private String getResponse(URI uri) throws IOException { HttpURLConnection http = (HttpURLConnection) uri.toURL().openConnection(); assertThat("Valid Response Code", http.getResponseCode(), anyOf(is(200), is(404))); try (InputStream in = http.getInputStream()) { return IO.toString(in, StandardCharsets.UTF_8); } }