wea*_*uff 19 java fileinputstream
如何在fileinputstream中输入一个文件到url?
我输入了Fileinputstream中的url,但是URL的输出是错误的,因为链接斜杠向后转向 - 从/到\和双斜杠//只有一个斜杠和向后.有一种方法fileinputstream要做到这一点?如果不是,你能告诉我应该使用什么而不是fileinputstream吗?
coo*_*ird 48
如果要获取InputStream
从URL检索数据,则使用该URL.openStream
方法将返回一个InputStream
,可以像任何其他一样使用InputStream
.
例如,
InputStream is;
// if we were getting data from a file, we might use:
is = new FileInputStream("/path/to/file");
// or, from a URL, then retrieve an InputStream from a URL
is = new URL("http://google.com/").openStream();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
39397 次 |
最近记录: |