What are Java data streams and how are they used to facilita
What are Java data streams and how are they used to facilitate storage and retrieval of persistent objects? please no hand writting answers.
Solution
Answer:
Java Data Streams:
=> Data streams support binary I/O of primitive data type values such as boolean, char, byte, short, int, long, float, and double as well as String values.
=> All data streams implement either the DataInput interface or the DataOutput interface.
a) data InPutStream : The InputStream is used to read data from a source.
b) data OutPutStream : The OutputStream is used for writing data to a destination.
Byte Streams:
Java byte streams are used to perform input and output of 8-bit bytes.
Character Streams
Java Byte streams are used to perform input and output of 8-bit bytes, whereas Java Character streams are used to perform input and output for 16-bit unicode.
=> the most frequently used classes are, FileReader and FileWriter.
A persistent object is one that sticks around and does not run away. It persists. A persistent object could define a record type. The stream can be tested to see if it fits into the record for example by looking for a delimiter.
for example a .csv file has comma delimiters . then it could for example be saved in a database or written to a file.
