projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add auto-closeable bucket wrapper and use try-with-resources
[Sone.git]
/
src
/
main
/
kotlin
/
net
/
pterodactylus
/
sone
/
utils
/
AutoCloseableBucket.kt
diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt
b/src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt
new file mode 100644
(file)
index 0000000..
58c181f
--- /dev/null
+++ b/
src/main/kotlin/net/pterodactylus/sone/utils/AutoCloseableBucket.kt
@@ -0,0
+1,11
@@
+package net.pterodactylus.sone.utils
+
+import freenet.support.api.Bucket
+
+class AutoCloseableBucket(val bucket: Bucket) : AutoCloseable {
+
+ override fun close() {
+ bucket.free()
+ }
+
+}