/** * Read all the data from the resource into memory. * * @param reader * The source reader to load the data from * @throws IOException */ public FullyBufferedReader(final Reader reader) throws IOException { this(Streams.readString(reader)); }
/** * Read all the data from the resource into memory. * * @param reader * The source reader to load the data from * @throws IOException */ public FullyBufferedReader(final Reader reader) throws IOException { super(); input = Streams.readString(reader); }
/** * Read all the data from the resource into memory. * * @param reader * The source reader to load the data from * @throws IOException */ public FullyBufferedReader(final Reader reader) throws IOException { super(); input = Streams.readString(reader); }
/** * Reads a stream as a string. * * @param in * The input stream * @return The string * @throws IOException */ public static String readString(final InputStream in) throws IOException { return readString(new BufferedReader(new InputStreamReader(in))); }
/** * Reads a stream as a string. * * @param in * The input stream * @return The string * @throws IOException */ public static String readString(final InputStream in) throws IOException { return readString(new BufferedReader(new InputStreamReader(in))); }
/** * Reads a stream as a string. * * @param in * The input stream * @return The string * @throws IOException */ public static String readString(final InputStream in) throws IOException { return readString(new BufferedReader(new InputStreamReader(in))); }
/** * @return String read from this file * @throws IOException */ public String readString() throws IOException { final InputStream in = new FileInputStream(this); try { return Streams.readString(in); } finally { in.close(); } }
/** * @return String read from this file * @throws IOException */ public final String readString() throws IOException { final InputStream in = new FileInputStream(this); try { return Streams.readString(in); } finally { in.close(); } }
/** * @return String read from this file * @throws IOException */ public final String readString() throws IOException { final InputStream in = new FileInputStream(this); try { return Streams.readString(in); } finally { in.close(); } }
private static String readTemplateFromResource(Class<?> clazz, String resourceName) { InputStream resourceAsStream = clazz.getResourceAsStream(resourceName); try { return Streams.readString(resourceAsStream, "UTF-8"); } catch (IOException e) { throw new RuntimeException(e); } finally { try { resourceAsStream.close(); } catch (IOException e) { throw new RuntimeException(e); } } }
/** * Reads a string using a character encoding. * * @param in * The input * @param encoding * The character encoding of the input data * @return The string * @throws IOException */ public static String readString(final InputStream in, final CharSequence encoding) throws IOException { return readString(new BufferedReader(new InputStreamReader(in, encoding.toString()))); }
/** * Reads a string using a character encoding. * * @param in * The input * @param encoding * The character encoding of the input data * @return The string * @throws IOException */ public static String readString(final InputStream in, final CharSequence encoding) throws IOException { return readString(new BufferedReader(new InputStreamReader(in, encoding.toString()))); }
/** * Reads a string using a character encoding. * * @param in * The input * @param encoding * The character encoding of the input data * @return The string * @throws IOException */ public static String readString(final InputStream in, final CharSequence encoding) throws IOException { return readString(new BufferedReader(new InputStreamReader(in, encoding.toString()))); }
private static String readResourceNoCache(Class scope, String file) { InputStream inputStream = null; try { final String path = Packages.absolutePath(scope, file); final IResourceStream resourceStream = Application.get().getResourceSettings().getResourceStreamLocator() .locate(scope, path); inputStream = resourceStream.getInputStream(); return Streams.readString(inputStream, "utf-8"); } catch (ResourceStreamNotFoundException e) { throw new RuntimeException(String.format("Can't find resource \"%s.%s\"", scope.getName(), file), e); } catch (IOException e) { throw new RuntimeException(String.format("Can't read resource \"%s.%s\"", scope.getName(), file), e); } finally { Closeables.closeQuietly(inputStream); } }
buffer.append(Streams.readString(stream.getInputStream(), encoding)); buffer.append(Streams.readString(stream.getInputStream()));
return Streams.readString(reader);
return Streams.readString(reader);
return Streams.readString(reader);
buffer.append(Streams.readString(stream.getInputStream(), encoding)); buffer.append(Streams.readString(stream.getInputStream()));
buffer.append(Streams.readString(stream.getInputStream(), encoding)); buffer.append(Streams.readString(stream.getInputStream()));