Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Sample code to handle file system
- */
- import java.io.File
- /**
- * Get all sub file objects in the directory.
- */
- fun sample1(path: String): Array<File> {
- val f = File(String)
- return f.listFiles()
- }
- /**
- * Iterate files in the directory.
- */
- fun sample2(path: String, block: File.() -> Unit) {
- val d = File(path)
- for (file in d.listFiles()) {
- block()
- }
- }
Add Comment
Please, Sign In to add comment