Take a look at the following problems in order to test your Java I/O programming prowess. I strongly encourage you to give each problem a try before you turn to the solutions and download the example programs:
- Creating file paths: Write several examples of creating several kinds of file paths (for example, absolute paths, relative paths, and so on).
- Converting file paths: Write several examples of converting file paths (for example, converting a file path into a string, URI, file, and so on).
- Joining file paths: Write several examples of joining (combining) file paths. Define a fixed path and append other different paths to it (or replace a part of it with other paths).
- Constructing a path between two locations: Write several examples that construct a relative path between two given paths (from one path to another).
- Comparing file paths: Write several examples of comparing the given file paths.
- Walking paths: Write a program that visits all the files within a directory, including subdirectories. Moreover, write a program that searches a file by name, deletes a directory, moves a directory, and copies a directory.
- Watching paths: Write several programs that watch changes that occur on a certain path (for example, create, delete, and modify).
- Streaming a file's content: Write a program that streams the content of the given file.
- Searching for files/folders in a file tree: Write a program that searches for the given files/folders in the given file tree.
- Reading/writing text files efficiently: Write several programs to exemplify different approaches for reading and writing a text file in an efficient manner.
- Reading/writing binary files efficiently: Write several programs to exemplify different approaches for reading and writing a binary file in an efficient manner.
- Searching in big files: Write a program that efficiently searches the given string in a big file.
- Reading a JSON/CSV file as an object: Write a program that reads the given JSON/CSV file as an object (POJO).
- Working with temporary files/folders: Write several programs for working with temporary files/folders.
- Filtering files: Write several user-defined filters for files.
- Discovering mismatches between two files: Write a program that discovers the mismatches between two files at the byte level.
- Circular byte buffer: Write a program that represents an implementation of a circular byte buffer.
- Tokenizing files: Write several snippets of code to exemplify different techniques of tokenizing a file content.
- Writing formatted output directly to a file: Write a program that formats the given numbers (integers and doubles) and outputs them to a file.
- Working with Scanner: Write several snippets of code to reveal Scanner capabilities.