Govt. Exams
Entrance Exams
reset() clears ObjectOutputStream's internal cache of serialized objects, allowing duplicate objects to be serialized again.
Transient fields are excluded from serialization and are initialized to default values upon deserialization.
DataInputStream with buffering allows sequential reading without loading the entire file into memory, making it ideal for large files.
The skip(long n) method skips n bytes in the input stream and returns the number of bytes actually skipped.
BufferedReader's readLine() method is the standard way to read lines. FileInputStream doesn't have readLine(), FileReader doesn't have readLine() either.
The mark() method marks the current position in the stream so it can be returned to later using reset(). Requires markSupported() to return true.
ObjectInputStream and ObjectOutputStream are used for serialization and deserialization of Java objects. Objects must implement Serializable interface.
FileInputStream reads directly from a file byte by byte, while BufferedInputStream wraps another stream and adds buffering to improve performance by reducing I/O operations.
InputStreamReader converts a byte stream (InputStream) into a character stream (Reader), acting as a bridge between the two.
DataInputStream provides methods like readInt(), readDouble(), readBoolean() to read primitive data types from a stream.