@Override public InputSupplier<? extends Reader> apply( final InputSupplier<? extends InputStream> input) { return CharStreams.newReaderSupplier(input, Charsets.UTF_8); } };
public static String toString(InputSupplier<? extends InputStream> supplier) throws IOException { return CharStreams.toString(CharStreams.newReaderSupplier(supplier, Charsets.UTF_8)); }
public static String toString(InputSupplier<? extends InputStream> supplier) throws IOException { return CharStreams.toString(CharStreams.newReaderSupplier(supplier, Charsets.UTF_8)); }
public static String toString(InputSupplier<? extends InputStream> supplier) throws IOException { return CharStreams.toString(CharStreams.newReaderSupplier(supplier, Charsets.UTF_8)); }
public static String toString(final InputStream stream) throws IOException { final InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() { @Override public InputStream getInput() throws IOException { return stream; } }; return CharStreams.toString(CharStreams.newReaderSupplier(inputSupplier, Charsets.UTF_8)); } }
private String tryGetVersion() { try { InputSupplier<? extends InputStream> versionFileSupplier = new InputSupplier<InputStream>() { @Override public InputStream getInput() throws IOException { return VersionCommand.class.getClassLoader().getResourceAsStream("VERSION"); } }; return CharStreams.toString(CharStreams.newReaderSupplier(versionFileSupplier, Charsets.UTF_8)); } catch (IOException e) { throw Throwables.propagate(e); } }
public static Senna load() throws IOException { return load(CharStreams.newReaderSupplier(DEFAULT_WORDS_SUPPLIER, Charsets.UTF_8), CharStreams.newReaderSupplier(DEFAULT_VECTORS_SUPPLIER, Charsets.UTF_8)); }
/** * Returns a factory that will supply instances of * {@link InputStreamReader} that read a URL using the given character set. * * @param url the URL to read from * @param charset the character set used when reading the URL contents * @return the factory */ public static InputSupplier<InputStreamReader> newReaderSupplier( URL url, Charset charset) { return CharStreams.newReaderSupplier(newInputStreamSupplier(url), charset); }
/** * Returns a factory that will supply instances of * {@link InputStreamReader} that read a URL using the given character set. * * @param url the URL to read from * @param charset the character set used when reading the URL contents * @return the factory */ public static InputSupplier<InputStreamReader> newReaderSupplier( URL url, Charset charset) { return CharStreams.newReaderSupplier(newInputStreamSupplier(url), charset); }
/** * Creates a new {@code SoyFileSupplier} given the file content provided as a string, as well * as the desired file path for messages. * * @param content The Soy file content. * @param soyFileKind The kind of this input Soy file. * @param filePath The path to the Soy file (used for messages only). */ public static SoyFileSupplier create( CharSequence content, SoyFileKind soyFileKind, String filePath) { return create(CharStreams.newReaderSupplier(content.toString()), soyFileKind, filePath); }
/** * Returns a factory that will supply instances of * {@link InputStreamReader} that read a file using the given character set. * * @param file the file to read from * @param charset the character set used when reading the file * @return the factory */ public static InputSupplier<InputStreamReader> newReaderSupplier(File file, Charset charset) { return CharStreams.newReaderSupplier(newInputStreamSupplier(file), charset); }
/** * Returns a factory that will supply instances of * {@link InputStreamReader} that read a file using the given character set. * * @param file the file to read from * @param charset the character set used when reading the file * @return the factory */ public static InputSupplier<InputStreamReader> newReaderSupplier(File file, Charset charset) { return CharStreams.newReaderSupplier(newInputStreamSupplier(file), charset); }
/** * Returns a factory that will supply instances of * {@link InputStreamReader} that read a URL using the given character set. * * @param url the URL to read from * @param charset the character set used when reading the URL contents * @return the factory */ public static InputSupplier<InputStreamReader> newReaderSupplier( URL url, Charset charset) { return CharStreams.newReaderSupplier(newInputStreamSupplier(url), charset); }
/** * Returns a factory that will supply instances of * {@link InputStreamReader} that read a file using the given character set. * * @param file the file to read from * @param charset the character set used when reading the file * @return the factory */ public static InputSupplier<InputStreamReader> newReaderSupplier(File file, Charset charset) { return CharStreams.newReaderSupplier(newInputStreamSupplier(file), charset); }
public static FrameCosts load() throws IOException { return fromCsv(CharStreams.newReaderSupplier(DEFAULT_INPUT_SUPPLIER, Charsets.UTF_8)); }
@Override String readString(URI uri, Charset charset) { try { return CharStreams.toString(CharStreams.newReaderSupplier(downloader.newInputSupplier(uri, this.readTimeout), charset)); } catch (IOException e) { throw failToDownload(uri, e); } }
public static String toString(final InputStream stream) throws IOException { final InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() { @Override public InputStream getInput() throws IOException { return stream; } }; return CharStreams.toString(CharStreams.newReaderSupplier(inputSupplier, Charsets.UTF_8)); }
private ConfigResponse createResponse(Application app) throws Exception { String specJson = getSpecJson(app); return new DefaultConfigResponse(0, CharStreams.newReaderSupplier(specJson)); }
@Override public synchronized FlowSpecification getSpecification() { if (specification == null) { expandIfNeeded(); try { specification = FlowSpecificationAdapter.create().fromJson( CharStreams.newReaderSupplier(Files.newInputStreamSupplier(specFile), Charsets.UTF_8)); } catch (IOException e) { throw Throwables.propagate(e); } } return specification; }
private List<String> readFromOutput(FileSet fileSet, String relativePath) throws IOException { // small amount of data, so expect all data from just 1 file Location location = fileSet.getLocation(relativePath).append("part-m-00000"); return CharStreams.readLines(CharStreams.newReaderSupplier(Locations.newInputSupplier(location), Charsets.UTF_8)); }