undefined

Practice with Files and Path

Java Collections
Level 1 , Lesson 4
Available

"Hi, Amigo!" I came up with a couple of interesting tasks for you."

"They can only be completed in IntelliJ IDEA. Take a look at these interesting conditions…"

undefined
14
Task
Java Collections, level 1, lesson 4
Locked
Your own implementation
Implement the following methods: 1. readBytes - must return all of the bytes in the fileName file. 2. readLines - must return all of the lines in the fileName file. Use the default encoding. 3. writeBytes - must write a byte array to the fileName file.
undefined
14
Task
Java Collections, level 1, lesson 4
Locked
Search for hidden files
In the Solution class, override the logic of the following two methods: visitFile - in addition to the existing logic, add all paths to ZIP and RAR files to the archived field; visitFileFailed - add all paths to inaccessible files to the failed field and return SKIP_SUBTREE.
undefined
14
Task
Java Collections, level 1, lesson 4
Locked
File downloader
Implement a downloadFile(String urlString, Path downloadDirectory) method whose inputs are a URL to a file to be downloaded and the destination folder for the download. The method must create a URL object and download the file's contents to the local disk. Download it to a temporary directory first so that if the download fails, there won't be partially downloaded files in your directory.
undefined
28
Task
Java Collections, level 1, lesson 4
Locked
What's in the folder?
Write a program that will read detailed information about a folder and display it on the console. First of all, read the folder path from the console. If the entered path is not a directory, display "[full path] is not a folder" and exit the program.
Comments (8)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Andrei Level 39
15 June 2021
Good exercises once you check the solution and try to go line by line to understand. Like you would do in a class before attempting yourself. Otherwise, just trying to solve them by yourself it would take crazy amount of time IMO. My method: first try myself for a while, try at least to generate the pseudo-code, the logic of how it would work. Then try and write some of the prepcode. When I get stuck try some googling. If not successful check solution and see what's different.
Wei Cui Level 39, Newark, United States
18 March 2020
hint for Your own implementation task Files.method wrap Paths.method from this link find needed method https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html
Csaba Gódor Level 24, Budapest, Hungary
17 January 2020
>> https://www.baeldung.com/java-nio-2-file-api for more infos
Robert Constantinescu Level 25, Bucharest, Romania
16 December 2019
Really, these new methods needs at least some examples... it's a little bit frustrating. It's doable, but i find the effort to search and implement the program according to the requirements without examples a little bit too much
hurzel purzel Level 22, Stuttgart, Germany
17 July 2019
I wish the knowledge needed for this excercise were actually taught in the lesson(s) before. We learned about "Path" and "Files", but not about "Paths".
Ewerton Level 30, Belo Horizonte, Brasil
8 July 2019
For the "File Downloader" one, don't create a temp directory, only a temp file. I was stuck trying to debug it for almost an hour. And if you are getting "FileAlreadyExistsException", just use REPLACE_EXISTING, on move and copy methods.