return Joiner.on(", ").join(descriptions);
}
+ @Override
String description(URI uri) {
return String.format("%s (%s)", uri.toString(), getProxySynthesis(uri));
}
}
}
+ @Override
String[] getSupportedSchemes() {
return new String[]{"http", "https"};
}
+ @Override
byte[] readBytes(URI uri) {
return download(uri);
}
+ @Override
String readString(URI uri, Charset charset) {
return downloadPlainText(uri, charset.name());
}
+ @Override
InputStream openStream(URI uri) {
try {
HttpURLConnection connection = newHttpConnection(uri);
*/
private static class FileProcessor extends SchemeProcessor {
+ @Override
public String[] getSupportedSchemes() {
return new String[]{"file"};
}
+ @Override
byte[] readBytes(URI uri) {
try {
return Files.toByteArray(new File(uri));
}
}
+ @Override
String readString(URI uri, Charset charset) {
try {
return Files.toString(new File(uri), charset);
}
}
+ @Override
InputStream openStream(URI uri) {
try {
return Files.newInputStreamSupplier(new File(uri)).getInput();
}
}
+ @Override
String description(URI uri) {
return new File(uri).getAbsolutePath();
}