Junior — Middle
Can you list the main types of implementations of the InputStream class in Java?
sobes.tech AI
Answer from AI
In Java, the InputStream class is an abstract class for reading byte streams. The main implementations of InputStream include:
- FileInputStream — reading from files.
- ByteArrayInputStream — reading from a byte array.
- BufferedInputStream — buffered input, improves performance.
- DataInputStream — allows reading primitive data types (int, float, etc.) from the stream.
- PipedInputStream — for inter-thread communication.
- ObjectInputStream — for reading serialized objects.
Each of these implementations serves different purposes when working with data streams.