我谨通过<代码>使用意图.setData(Uri uri)通过从URL获得的数据。 为此,我需要能够从URL(或从旁听)中建立一个Uri。 页: 1 ByteArrayInputStream 页: 1 然而,我无法说明应如何做到这一点。
So, is there anyway to create a Uri from data obtained from a URL without first writing the data to a local file?
我谨通过<代码>使用意图.setData(Uri uri)通过从URL获得的数据。 为此,我需要能够从URL(或从旁听)中建立一个Uri。 页: 1 ByteArrayInputStream 页: 1 然而,我无法说明应如何做到这一点。
So, is there anyway to create a Uri from data obtained from a URL without first writing the data to a local file?
http://docs.oracle.com/javase/6/docs/api/java/net/URL.html#toURI%2829”rel=“noreferer”>URL.toURI()
(。
例:
URL url = new URL("http://www.google.com"); //Some instantiated URL object
URI uri = url.toURI();
http://docs.oracle.com/javase/6/docs/api/java/net/URISyntaxException.html
I think your answer can be found from here..
Uri.Builder.build(
> 运行良好,正常的URLs运行良好,但未能得到港口号码支持。
我发现最容易地使其支持港口号码,就是让港口停泊,先与港口局合作。
Uri.Builder b = Uri.parse("http://www.yoursite.com:12345").buildUpon();
b.path("/path/to/something/");
b.appendQueryParameter("arg1", String.valueOf(42));
if (username != "") {
b.appendQueryParameter("username", username);
}
String url = b.build().toString();
资料来源:。
From How to create a Uri from a URL?
Uri uri = Uri.parse( "http://www.facebook.com" );
注:在安内斯,Uri s与Java URI s不同。 在这里,如何避免使用硬编码拼法,同时,创建一条Uri,其途径部分仅包括http URL string encoded to RFC2396:
Sample Url String:
String thisUrl = "http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=[redacted]&mapid=value"
方法:
private Uri.Builder builder;
public Uri getUriFromUrl(String thisUrl) {
URL url = new URL(thisUrl);
builder = new Uri.Builder()
.scheme(url.getProtocol())
.authority(url.getAuthority())
.appendPath(url.getPath());
return builder.build();
}
为了处理询问,你需要将所描述的“url.get Query”(,,然后将这些资料输入建筑商。 附录。
try {
uri = new URI(url.toString());
} catch (URISyntaxException e) {
}
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...