腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
搜索
关闭
文章
问答
(246)
视频
开发者手册
清单
用户
专栏
沙龙
全部问答
原创问答
Stack Exchange问答
更多筛选
回答情况:
全部
有回答
回答已采纳
提问时间:
不限
一周内
一月内
三月内
一年内
问题标签:
未找到与 相关的标签
筛选
重置
3
回答
try-with-resources
我有一个非常简单的问题,虽然在我看来很愚蠢,但却要求.How BufferedReader调用Autocloseable接口的close()方法。或者我们如何实现自动调用close()的Autocloseable。
浏览 2
提问于2015-03-11
得票数 0
2
回答
Java
try-with-resources
语法不规范
所以我浏览了java7的一些新特性,包括位。try OutputStream fos = new FileOutputStream(target)) // stuff } // stuff具体地说,资源的定义: try (InputStream fis = new
浏览 2
提问于2011-07-29
得票数 10
3
回答
try-with-resources
或close()困境
我有一个可以抛出IOException的函数,所以我不会在内部捕获异常。然而,我有一些资源要关闭。这样做正确吗?使用try-with-resource (不带任何catch块): // Do some stuff}public void workOnFiles() throws IOExce
浏览 0
提问于2013-07-28
得票数 1
2
回答
try-with-resources
和方法链接
我想通过方法链接使用try- with -resources:try (Scanner s = new Scanner(entity.getContent()).useDelimiter("\\A")) { return page;我在new Scanner(...)上收到“资源泄漏:永远不会关闭”HttpEntity entity = response.getE
浏览 0
修改于2015-12-23
得票数 2
1
回答
try catch vs
try-with-resources
为什么在readFile2()中我需要捕获FileNotFoundException,然后是close()方法抛出的IOException,而在
try-with-resources
(inside readfile1
浏览 17
修改于2019-06-13
得票数 2
回答已采纳
1
回答
不能使用
try-with-resources
或finally块
我的代码正在从web上读取一个HTML页面,我想写出好的代码,所以我想使用
try-with-resources
或want block来关闭资源。in.close(); catch (IOException e) { } 您是否能够使用
try-with-resources
浏览 1
修改于2013-05-04
得票数 0
3
回答
Groovy,"
try-with-resources
“构建替代方案
我是Groovy的新手。在处理I/O流时,我经常在Java代码中使用“try- with -resources”结构。
浏览 2
修改于2018-04-10
得票数 59
回答已采纳
1
回答
Try-with-resources
api PR19
他们说,只有19API支持
try-with-resources
,但并非如此。 我已经用Realm自己测试过了。
浏览 3
提问于2017-08-30
得票数 3
2
回答
在Netbeans - Cool Beans中“转换为
try-with-resources
”?
BufferedOutputStream(new FileOutputStream(filename));bos.close(); 一条警告建议我“转换为
try-with-resources
浏览 0
修改于2016-02-10
得票数 10
回答已采纳
1
回答
使用
Try-with-Resources
时编译出错
我是一个Java新手,正在编写一段
Try-with-Resources
的代码。我正在使用JRE_1.7.0_51。密码是..。
浏览 2
提问于2014-02-01
得票数 0
1
回答
声纳:如何使用
try-with-resources
关闭FileOutputStream
我需要修改以下代码以使用
try-with-resources
。我该怎么做呢?
浏览 0
修改于2016-12-21
得票数 7
回答已采纳
4
回答
使用
try-with-resources
静默关闭资源
是否可以忽略使用
try-with-resources
语句关闭资源时抛出的异常?
浏览 0
修改于2014-02-10
得票数 37
回答已采纳
1
回答
对Base而不是DB使用
Try-with-resources
我喜欢使用
try-with-resources
来访问我的数据库,因为我的代码已经达到了复杂的程度,在线程之间移动时很难始终记住关闭数据库-我更喜欢使用
try-with-resources
。
浏览 16
提问于2019-04-21
得票数 0
回答已采纳
3
回答
Java 1.6中等效的
Try-with-resources
我有以下代码: Connection conn = DBUtil.getConnection(DBType.HSQLDB); ResultSet.TYPE_SC
浏览 1
修改于2014-05-12
得票数 12
1
回答
来自try块和
try-with-resources
的异常
说 如何
浏览 4
提问于2020-08-12
得票数 1
回答已采纳
2
回答
在
try-with-resources
中为空检查
我得到了以下代码:我如何检查这里的连接是否不为空?private PreparedStatement getPreparedStatement(Connection connection) P
浏览 56
提问于2020-02-28
得票数 0
回答已采纳
1
回答
如何将try-finally更改为
try-with-resources
?
或者,在这种情况下,使用try-finally比使用
try-with-resources
更好?
浏览 22
提问于2021-03-12
得票数 2
3
回答
try-with-resources
中的Java预准备语句不起作用
昨天,Stack上的许多人推荐使用
try-with-resources
。我现在正在为我的所有数据库操作执行此操作。今天,我想将语句更改为PreparedStatement,以使查询更安全。但是,当我尝试在
try-with-resources
中使用准备好的语句时,我总是得到像'identifier expected‘、';’或')‘这样的错误。 我做错了什么?或者这是不可能的?
浏览 1
提问于2014-07-24
得票数 6
1
回答
Fortify将
try-with-resources
标记为中等严重级别的问题
我已经生成了加强的代码审查,并最终获得了关闭FileStream(在
try-with-resources
块中)和file.delete的中等严重程度。如何删除这些问题?
浏览 0
修改于2017-07-28
得票数 0
1
回答
Fortify -
try-with-resources
中存在三元组的未释放资源流问题
getResourceAsStream("someFile.xml") : new FileInputStream(new File(someLocation))) { } Fortify抱怨具有此
try-with-resources
try-with-resources
不是可以帮助我自动关闭FileInputStream吗? 假设Fortify不识别
try-with-resources
范式,我没有使用它,而是以常规的方式使用它。
浏览 68
提问于2021-05-11
得票数 2
第 2 页
第 3 页
第 4 页
第 5 页
第 6 页
第 7 页
第 8 页
第 9 页
第 10 页
第 11 页
点击加载更多
领券