开发者社区 问答 正文

从 url 中下载文件时的错误

我想从url中读取一个文件,然后定义它为一个File Type
screenshot
但是代码在OutputStream output = new FileOutputStream (file); 处出错了。
请问如何定义 URl 中的文件?

展开
收起
蛮大人123 2016-02-18 12:00:29 2410 分享 版权
1 条回答
写回答
取消 提交回答
  • 我说我不帅他们就打我,还说我虚伪
     /**
         * Constructs a new file using the specified path.
         *
         * @param path
         *            the path to be used for the file.
         */
        public File(String path) {
            this.path = fixSlashes(path);
        }

    这是File的构造方法,你那是找不到文件的 path应该是绝对路径.

    2019-07-17 18:43:52
    赞同 展开评论
问答地址: