Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why kotlin File class has no close method?

Tags:

kotlin

I've been reading KotlinDoc for the stdlib/kotlin.io.File class. But I can't see any mention of a close() method nor an autocloseable feature : so what is really happening when a File instance get garbage collected ?

like image 272
loloof64 Avatar asked Sep 13 '25 10:09

loloof64


1 Answers

java.io.File (there is no kolin.io.File at the moment) is not something you can close. See official docs: https://docs.oracle.com/javase/8/docs/api/java/io/File.html

like image 143
Andrey Breslav Avatar answered Sep 15 '25 01:09

Andrey Breslav