Summary
In this chapter, you have been introduced to two main APIs in the Java language: java.io and java.nio. They have some overlapping functions, and they are needed to deal with streams and files. On top of that, you have seen how to work with sockets, a natural source of data that can only be handled with streams.
There have been a series of examples looking at how to capture data from the terminal, which in the end happened to be stream (System.in)
. You then explored how to process it using streams with all sorts of high-level functions, such as filter, map, sorted, foreach, reduce, and collect. You have seen how to open files and properties files, and how java.nio is very capable with the former, but not with the latter.
From a more practical perspective, this chapter has introduced one important technique that was only explained in theory in an earlier chapter: how to use finally
to close streams, and avoid potential memory issues during runtime. You have seen that, in...