Start learning now
You've reached Level 18!
Congratulations, you've completed the seventh level of the quest! It truly was difficult. You have continued to get acquainted with threads, and begun to handle problems related to multithreading. You've completed 23 tasks (or about that many). Continuing in that same spirit, we'll take a closer look at input/output streams.
In fact, you already know something about I/O streams. Remember System.out.println? Guess what? System.out is a static PrintStream (a descendant of OutputStream) variable in the System class. So all this time you've been happily using a PrintStream.
Streams for file I/O
In this lesson, your teacher Rishi will tell you about two classes for reading and writing files. They are FileInputStream and FileOutputStream. As you probably already guessed, the first lets you sequentially read bytes from a file; with the second, you can sequentially write bytes to a file. Click on the lesson, and you'll learn how these classes are organized.
Practice with FileInputStream and FileOutputStream
You never know whether you understand a topic until you've tried to apply your knowledge in practice! Diego knows this well. So today he has prepared five tasks for you to practice using the FileInputStream and FileOutputStream classes. We'll look for and display the minimum, maximum, most frequent, and rarest bytes in a file.
Today, your teacher Ellie will help you to better understand the nature of InputStream and OutputStream. You'll learn that these two are not interfaces at all: they're abstract classes. They even have a couple of implemented methods. Which? Find out in this lesson.
Practice with InputStream/OutputStream
Diego, a robot and skilled teacher, believes that students on Level 8 of the second quest don't study enough. What's more, it's crunch time right now! So, there's no time to cool off. You're being pushed to complete tasks on the "Taming of InputStream and OutputStream in the wild".
Have you noticed how many complicated compound words Java has? Today's lesson is devoted to the elegantly named BufferedInputStream class. But first, your teacher Kim will tell you about the wrapper design pattern and why it is needed.
Write your own stream: a wrapper for System.in
Today we'll explore some super interesting stuff: how to replace the System.in input stream. First, we need to create a buffer, and then put some values into it. Then we'll wrap it in a class that knows how to read data from the buffer using the InputStream protocol. The details are in the lesson.
Practice with streams | Level 8
If you've enjoyed learning about streams, all these wrappers, and BufferedInputStream, you'll take pleasure in completing these five tasks, which have been prepared for you by Diego the Magnificent. And if you haven't liked the topic... Well, you'll complete them without pleasure. How can you escape it?
Useful links from the Professor — 18
Of course, looking at the same material from different angles is useful, because everyone thinks differently, and perhaps for you the best source of the theory will be different from the source best suited to your friend. Especially for you, the Professor found a very interesting lesson online that will teach you a lot more about input/output streams.
The making of Skyrim
We have this tradition at CodeGym: near the end of the level, your teacher Julio invites you to watch an interesting and fascinating IT video. Sit back and relax. You'll learn a lot of new stuff, and even get some dark matter for it... This time the video is about Skyrim.
Bonus task | Lesson 11 | Level 8
Captain Squirrels is on the phone! He has a couple of surprises for you. More precisely, not a couple, and they aren't surprises, but rather ten tasks to reinforce your knowledge about threads. And the truly curious can try their hand on three bonus tasks that are more difficult. One of them will be devoted to file encryption and decryption.