Entrance Exams
Govt. Exams
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.
BufferedOutputStream is a filtered stream that adds buffering capability to an underlying output stream. Filtered streams wrap other streams to add functionality.
Attempting to read from a closed stream throws an IOException. The stream must be open for read operations.
BufferedReader has a default buffer size of 8192 characters, but commonly 2048 bytes is used. The exact implementation may vary, but 8192 is the default character buffer.