Example program for file updating random access
Byte-based streams are mainly used for storing/manipulating data in binary format, whereas a character-based stream stores/manipulates data as a sequence of characters.
For example, if we want to store, say 3, it would be stored in the binary format of the numeric value 3, or 011(3 in binary) in byte based stream.
Garbage collector is a component that works as a janitor in JVM, responsible for keeping the memory clean to avoid memory leaks—to release the occupied but out of scope players (read objects and variables) from the playground for other players to pour in.
This is a very automated process; the programmer need not worry about it at all.
In Java, files are nothing but a sequential stream of data terminated by an end of file marker.
The end of file marker is denoted by a special mark or count of total bytes, recorded in a system-maintained file data structure.
At first glance, it may seem fussy, but the distinction is important.
The character treatment of a stream of data is used to create text files. Binary files yielded from a binary stream require a special program that converts the data to a human-readable format.
Their use is specific, mainly to interact with the system and to serve special purposes.
This class object comes in handy on several occasions, mainly in dealing with files in Java programming.
To appreciate its utility, let's try a simple program that works like the minimal Output: Figure 1: Output of preceding code To keep things simple, we'll work with text files and how to read and write streams of data into them.